diff options
author | Matias Elo <matias.elo@nokia.com> | 2022-09-23 13:15:58 +0300 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2022-10-07 14:12:02 +0300 |
commit | 32a630e3898a0306f78b3b6430663873a93de4b5 (patch) | |
tree | db9f83e0098e1417dfc1946661e667540ad016b4 /platform | |
parent | 96e86e6f9a9fe9a63f2609c28af6e41ddbf1a9d9 (diff) |
linux-gen: debug: prefix implementation internal debug macros
Prefix implementation internal debug macro names with underscore.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Diffstat (limited to 'platform')
76 files changed, 2122 insertions, 2245 deletions
diff --git a/platform/linux-generic/arch/aarch64/cpu_flags.c b/platform/linux-generic/arch/aarch64/cpu_flags.c index e013f749f..9c2e9fa45 100644 --- a/platform/linux-generic/arch/aarch64/cpu_flags.c +++ b/platform/linux-generic/arch/aarch64/cpu_flags.c @@ -494,363 +494,363 @@ static void _odp_sys_info_print_acle_flags(void) (void)ndef; /* See ARM C Language Extensions documentation for details */ - ODP_PRINT("ARM FEATURES:\n"); + _ODP_PRINT("ARM FEATURES:\n"); - ODP_PRINT(" __ARM_ALIGN_MAX_PWR "); + _ODP_PRINT(" __ARM_ALIGN_MAX_PWR "); #ifdef __ARM_ALIGN_MAX_PWR - ODP_PRINT("%i\n", __ARM_ALIGN_MAX_PWR); + _ODP_PRINT("%i\n", __ARM_ALIGN_MAX_PWR); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_ALIGN_MAX_STACK_PWR "); + _ODP_PRINT(" __ARM_ALIGN_MAX_STACK_PWR "); #ifdef __ARM_ALIGN_MAX_STACK_PWR - ODP_PRINT("%i\n", __ARM_ALIGN_MAX_STACK_PWR); + _ODP_PRINT("%i\n", __ARM_ALIGN_MAX_STACK_PWR); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_ARCH "); + _ODP_PRINT(" __ARM_ARCH "); #ifdef __ARM_ARCH - ODP_PRINT("%i\n", __ARM_ARCH); + _ODP_PRINT("%i\n", __ARM_ARCH); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_ARCH_ISA_A64 "); + _ODP_PRINT(" __ARM_ARCH_ISA_A64 "); #ifdef __ARM_ARCH_ISA_A64 - ODP_PRINT("%i\n", __ARM_ARCH_ISA_A64); + _ODP_PRINT("%i\n", __ARM_ARCH_ISA_A64); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_BIG_ENDIAN "); + _ODP_PRINT(" __ARM_BIG_ENDIAN "); #ifdef __ARM_BIG_ENDIAN - ODP_PRINT("%i\n", __ARM_BIG_ENDIAN); + _ODP_PRINT("%i\n", __ARM_BIG_ENDIAN); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_BF16_FORMAT_ALTERNATIVE "); + _ODP_PRINT(" __ARM_BF16_FORMAT_ALTERNATIVE "); #ifdef __ARM_BF16_FORMAT_ALTERNATIVE - ODP_PRINT("%i\n", __ARM_BF16_FORMAT_ALTERNATIVE); + _ODP_PRINT("%i\n", __ARM_BF16_FORMAT_ALTERNATIVE); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_ATOMICS "); + _ODP_PRINT(" __ARM_FEATURE_ATOMICS "); #ifdef __ARM_FEATURE_ATOMICS - ODP_PRINT("%i\n", __ARM_FEATURE_ATOMICS); + _ODP_PRINT("%i\n", __ARM_FEATURE_ATOMICS); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_BF16 "); + _ODP_PRINT(" __ARM_FEATURE_BF16 "); #ifdef __ARM_FEATURE_BF16 - ODP_PRINT("%i\n", __ARM_FEATURE_BF16); + _ODP_PRINT("%i\n", __ARM_FEATURE_BF16); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_BTI_DEFAULT "); + _ODP_PRINT(" __ARM_FEATURE_BTI_DEFAULT "); #ifdef __ARM_FEATURE_BTI_DEFAULT - ODP_PRINT("%i\n", __ARM_FEATURE_BTI_DEFAULT); + _ODP_PRINT("%i\n", __ARM_FEATURE_BTI_DEFAULT); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_CDE "); + _ODP_PRINT(" __ARM_FEATURE_CDE "); #ifdef __ARM_FEATURE_CDE - ODP_PRINT("%i\n", __ARM_FEATURE_CDE); + _ODP_PRINT("%i\n", __ARM_FEATURE_CDE); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_CDE_COPROC "); + _ODP_PRINT(" __ARM_FEATURE_CDE_COPROC "); #ifdef __ARM_FEATURE_CDE_COPROC - ODP_PRINT("0x%X\n", __ARM_FEATURE_CDE_COPROC); + _ODP_PRINT("0x%X\n", __ARM_FEATURE_CDE_COPROC); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_CLZ "); + _ODP_PRINT(" __ARM_FEATURE_CLZ "); #ifdef __ARM_FEATURE_CLZ - ODP_PRINT("%i\n", __ARM_FEATURE_CLZ); + _ODP_PRINT("%i\n", __ARM_FEATURE_CLZ); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_COMPLEX "); + _ODP_PRINT(" __ARM_FEATURE_COMPLEX "); #ifdef __ARM_FEATURE_COMPLEX - ODP_PRINT("%i\n", __ARM_FEATURE_COMPLEX); + _ODP_PRINT("%i\n", __ARM_FEATURE_COMPLEX); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_COPROC "); + _ODP_PRINT(" __ARM_FEATURE_COPROC "); #ifdef __ARM_FEATURE_COPROC - ODP_PRINT("0x%X\n", __ARM_FEATURE_COPROC); + _ODP_PRINT("0x%X\n", __ARM_FEATURE_COPROC); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_CRC32 "); + _ODP_PRINT(" __ARM_FEATURE_CRC32 "); #ifdef __ARM_FEATURE_CRC32 - ODP_PRINT("%i\n", __ARM_FEATURE_CRC32); + _ODP_PRINT("%i\n", __ARM_FEATURE_CRC32); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_CRYPTO "); + _ODP_PRINT(" __ARM_FEATURE_CRYPTO "); #ifdef __ARM_FEATURE_CRYPTO - ODP_PRINT("%i\n", __ARM_FEATURE_CRYPTO); + _ODP_PRINT("%i\n", __ARM_FEATURE_CRYPTO); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_DIRECTED_ROUNDING "); + _ODP_PRINT(" __ARM_FEATURE_DIRECTED_ROUNDING "); #ifdef __ARM_FEATURE_DIRECTED_ROUNDING - ODP_PRINT("%i\n", __ARM_FEATURE_DIRECTED_ROUNDING); + _ODP_PRINT("%i\n", __ARM_FEATURE_DIRECTED_ROUNDING); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_DOTPROD "); + _ODP_PRINT(" __ARM_FEATURE_DOTPROD "); #ifdef __ARM_FEATURE_DOTPROD - ODP_PRINT("%i\n", __ARM_FEATURE_DOTPROD); + _ODP_PRINT("%i\n", __ARM_FEATURE_DOTPROD); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_FMA "); + _ODP_PRINT(" __ARM_FEATURE_FMA "); #ifdef __ARM_FEATURE_FMA - ODP_PRINT("%i\n", __ARM_FEATURE_FMA); + _ODP_PRINT("%i\n", __ARM_FEATURE_FMA); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_FP16_FML "); + _ODP_PRINT(" __ARM_FEATURE_FP16_FML "); #ifdef __ARM_FEATURE_FP16_FML - ODP_PRINT("%i\n", __ARM_FEATURE_FP16_FML); + _ODP_PRINT("%i\n", __ARM_FEATURE_FP16_FML); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_FRINT "); + _ODP_PRINT(" __ARM_FEATURE_FRINT "); #ifdef __ARM_FEATURE_FRINT - ODP_PRINT("%i\n", __ARM_FEATURE_FRINT); + _ODP_PRINT("%i\n", __ARM_FEATURE_FRINT); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_IDIV "); + _ODP_PRINT(" __ARM_FEATURE_IDIV "); #ifdef __ARM_FEATURE_IDIV - ODP_PRINT("%i\n", __ARM_FEATURE_IDIV); + _ODP_PRINT("%i\n", __ARM_FEATURE_IDIV); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_JCVT "); + _ODP_PRINT(" __ARM_FEATURE_JCVT "); #ifdef __ARM_FEATURE_JCVT - ODP_PRINT("%i\n", __ARM_FEATURE_JCVT); + _ODP_PRINT("%i\n", __ARM_FEATURE_JCVT); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_MATMUL_INT8 "); + _ODP_PRINT(" __ARM_FEATURE_MATMUL_INT8 "); #ifdef __ARM_FEATURE_MATMUL_INT8 - ODP_PRINT("%i\n", __ARM_FEATURE_MATMUL_INT8); + _ODP_PRINT("%i\n", __ARM_FEATURE_MATMUL_INT8); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_MEMORY_TAGGING "); + _ODP_PRINT(" __ARM_FEATURE_MEMORY_TAGGING "); #ifdef __ARM_FEATURE_MEMORY_TAGGING - ODP_PRINT("%i\n", __ARM_FEATURE_MEMORY_TAGGING); + _ODP_PRINT("%i\n", __ARM_FEATURE_MEMORY_TAGGING); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_MVE "); + _ODP_PRINT(" __ARM_FEATURE_MVE "); #ifdef __ARM_FEATURE_MVE - ODP_PRINT("0x%X\n", __ARM_FEATURE_MVE); + _ODP_PRINT("0x%X\n", __ARM_FEATURE_MVE); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_NUMERIC_MAXMIN "); + _ODP_PRINT(" __ARM_FEATURE_NUMERIC_MAXMIN "); #ifdef __ARM_FEATURE_NUMERIC_MAXMIN - ODP_PRINT("%i\n", __ARM_FEATURE_NUMERIC_MAXMIN); + _ODP_PRINT("%i\n", __ARM_FEATURE_NUMERIC_MAXMIN); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_PAC_DEFAULT "); + _ODP_PRINT(" __ARM_FEATURE_PAC_DEFAULT "); #ifdef __ARM_FEATURE_PAC_DEFAULT - ODP_PRINT("0x%X\n", __ARM_FEATURE_PAC_DEFAULT); + _ODP_PRINT("0x%X\n", __ARM_FEATURE_PAC_DEFAULT); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_QRDMX "); + _ODP_PRINT(" __ARM_FEATURE_QRDMX "); #ifdef __ARM_FEATURE_QRDMX - ODP_PRINT("%i\n", __ARM_FEATURE_QRDMX); + _ODP_PRINT("%i\n", __ARM_FEATURE_QRDMX); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_RNG "); + _ODP_PRINT(" __ARM_FEATURE_RNG "); #ifdef __ARM_FEATURE_RNG - ODP_PRINT("%i\n", __ARM_FEATURE_RNG); + _ODP_PRINT("%i\n", __ARM_FEATURE_RNG); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_SHA3 "); + _ODP_PRINT(" __ARM_FEATURE_SHA3 "); #ifdef __ARM_FEATURE_SHA3 - ODP_PRINT("%i\n", __ARM_FEATURE_SHA3); + _ODP_PRINT("%i\n", __ARM_FEATURE_SHA3); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_SHA512 "); + _ODP_PRINT(" __ARM_FEATURE_SHA512 "); #ifdef __ARM_FEATURE_SHA512 - ODP_PRINT("%i\n", __ARM_FEATURE_SHA512); + _ODP_PRINT("%i\n", __ARM_FEATURE_SHA512); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_SM3 "); + _ODP_PRINT(" __ARM_FEATURE_SM3 "); #ifdef __ARM_FEATURE_SM3 - ODP_PRINT("%i\n", __ARM_FEATURE_SM3); + _ODP_PRINT("%i\n", __ARM_FEATURE_SM3); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_SM4 "); + _ODP_PRINT(" __ARM_FEATURE_SM4 "); #ifdef __ARM_FEATURE_SM4 - ODP_PRINT("%i\n", __ARM_FEATURE_SM4); + _ODP_PRINT("%i\n", __ARM_FEATURE_SM4); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_TME "); + _ODP_PRINT(" __ARM_FEATURE_TME "); #ifdef __ARM_FEATURE_TME - ODP_PRINT("%i\n", __ARM_FEATURE_TME); + _ODP_PRINT("%i\n", __ARM_FEATURE_TME); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FEATURE_UNALIGNED "); + _ODP_PRINT(" __ARM_FEATURE_UNALIGNED "); #ifdef __ARM_FEATURE_UNALIGNED - ODP_PRINT("%i\n", __ARM_FEATURE_UNALIGNED); + _ODP_PRINT("%i\n", __ARM_FEATURE_UNALIGNED); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FP "); + _ODP_PRINT(" __ARM_FP "); #ifdef __ARM_FP - ODP_PRINT("0x%X\n", __ARM_FP); + _ODP_PRINT("0x%X\n", __ARM_FP); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FP_FAST "); + _ODP_PRINT(" __ARM_FP_FAST "); #ifdef __ARM_FP_FAST - ODP_PRINT("%i\n", __ARM_FP_FAST); + _ODP_PRINT("%i\n", __ARM_FP_FAST); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FP_FENV_ROUNDING "); + _ODP_PRINT(" __ARM_FP_FENV_ROUNDING "); #ifdef __ARM_FP_FENV_ROUNDING - ODP_PRINT("%i\n", __ARM_FP_FENV_ROUNDING); + _ODP_PRINT("%i\n", __ARM_FP_FENV_ROUNDING); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FP16_ARGS "); + _ODP_PRINT(" __ARM_FP16_ARGS "); #ifdef __ARM_FP16_ARGS - ODP_PRINT("%i\n", __ARM_FP16_ARGS); + _ODP_PRINT("%i\n", __ARM_FP16_ARGS); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FP16_FORMAT_ALTERNATIVE "); + _ODP_PRINT(" __ARM_FP16_FORMAT_ALTERNATIVE "); #ifdef __ARM_FP16_FORMAT_ALTERNATIVE - ODP_PRINT("%i\n", __ARM_FP16_FORMAT_ALTERNATIVE); + _ODP_PRINT("%i\n", __ARM_FP16_FORMAT_ALTERNATIVE); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_FP16_FORMAT_IEEE "); + _ODP_PRINT(" __ARM_FP16_FORMAT_IEEE "); #ifdef __ARM_FP16_FORMAT_IEEE - ODP_PRINT("%i\n", __ARM_FP16_FORMAT_IEEE); + _ODP_PRINT("%i\n", __ARM_FP16_FORMAT_IEEE); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_NEON "); + _ODP_PRINT(" __ARM_NEON "); #ifdef __ARM_NEON - ODP_PRINT("%i\n", __ARM_NEON); + _ODP_PRINT("%i\n", __ARM_NEON); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_NEON_FP "); + _ODP_PRINT(" __ARM_NEON_FP "); #ifdef __ARM_NEON_FP - ODP_PRINT("0x%X\n", __ARM_NEON_FP); + _ODP_PRINT("0x%X\n", __ARM_NEON_FP); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_PCS_AAPCS64 "); + _ODP_PRINT(" __ARM_PCS_AAPCS64 "); #ifdef __ARM_PCS_AAPCS64 - ODP_PRINT("%i\n", __ARM_PCS_AAPCS64); + _ODP_PRINT("%i\n", __ARM_PCS_AAPCS64); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_ROPI "); + _ODP_PRINT(" __ARM_ROPI "); #ifdef __ARM_ROPI - ODP_PRINT("%i\n", __ARM_ROPI); + _ODP_PRINT("%i\n", __ARM_ROPI); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_RWPI "); + _ODP_PRINT(" __ARM_RWPI "); #ifdef __ARM_RWPI - ODP_PRINT("%i\n", __ARM_RWPI); + _ODP_PRINT("%i\n", __ARM_RWPI); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_SIZEOF_MINIMAL_ENUM "); + _ODP_PRINT(" __ARM_SIZEOF_MINIMAL_ENUM "); #ifdef __ARM_SIZEOF_MINIMAL_ENUM - ODP_PRINT("%i\n", __ARM_SIZEOF_MINIMAL_ENUM); + _ODP_PRINT("%i\n", __ARM_SIZEOF_MINIMAL_ENUM); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" __ARM_SIZEOF_WCHAR_T "); + _ODP_PRINT(" __ARM_SIZEOF_WCHAR_T "); #ifdef __ARM_SIZEOF_WCHAR_T - ODP_PRINT("%i\n", __ARM_SIZEOF_WCHAR_T); + _ODP_PRINT("%i\n", __ARM_SIZEOF_WCHAR_T); #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT(" ARM ISA version: "); + _ODP_PRINT(" ARM ISA version: "); #if defined(__ARM_ARCH) if (__ARM_ARCH < 8) { - ODP_PRINT("v%i\n", __ARM_ARCH); + _ODP_PRINT("v%i\n", __ARM_ARCH); } else if (__ARM_ARCH == 8) { /* Actually, this checks for new NEON instructions in * v8.1, but is currently the only way to distinguish * v8.0 and >=v8.1. */ #ifdef __ARM_FEATURE_QRDMX - ODP_PRINT("v8.1 or higher\n"); + _ODP_PRINT("v8.1 or higher\n"); #else - ODP_PRINT("v8.0\n"); + _ODP_PRINT("v8.0\n"); #endif } else { /* ACLE 2018 defines that from v8.1 onwards the value includes @@ -859,13 +859,13 @@ static void _odp_sys_info_print_acle_flags(void) int major = __ARM_ARCH / 100; int minor = __ARM_ARCH - (major * 100); - ODP_PRINT("v%i.%i\n", major, minor); + _ODP_PRINT("v%i.%i\n", major, minor); } #else - ODP_PRINT("%s\n", ndef); + _ODP_PRINT("%s\n", ndef); #endif - ODP_PRINT("\n"); + _ODP_PRINT("\n"); } static int check_hwcap_duplicates(unsigned int hwcap_field) @@ -893,7 +893,7 @@ static void _odp_sys_info_print_hwcap_flags(void) unsigned long hwcaps, hwcaps2; unsigned int size, size2; - ODP_PRINT("ARM FEATURES SUPPORTED BY HARDWARE:\n"); + _ODP_PRINT("ARM FEATURES SUPPORTED BY HARDWARE:\n"); /* Print supported hardware flags via AT_HWCAP entry of the hwcaps * auxiliary vector. */ @@ -907,7 +907,7 @@ static void _odp_sys_info_print_hwcap_flags(void) } if (hwcaps & 0x01) - ODP_PRINT("%s ", hwcap_flags[i].feat_flag); + _ODP_PRINT("%s ", hwcap_flags[i].feat_flag); hwcaps = hwcaps >> 1; } } @@ -919,18 +919,18 @@ static void _odp_sys_info_print_hwcap_flags(void) for (unsigned long i = 0; i < size2; i++) { if (hwcap2_flags[i].valid) { if (hwcaps2 & 0x01) - ODP_PRINT("%s ", hwcap2_flags[i].feat_flag); + _ODP_PRINT("%s ", hwcap2_flags[i].feat_flag); hwcaps2 = hwcaps2 >> 1; } } - ODP_PRINT("\n"); + _ODP_PRINT("\n"); /* Re-initialize hwcaps and hwcaps2 */ hwcaps = 0; hwcaps2 = 0; - ODP_PRINT("\nARM FEATURES NOT SUPPORTED BY HARDWARE:\n"); + _ODP_PRINT("\nARM FEATURES NOT SUPPORTED BY HARDWARE:\n"); hwcaps = getauxval(AT_HWCAP); for (unsigned long i = 0; i < size; i++) { @@ -941,7 +941,7 @@ static void _odp_sys_info_print_hwcap_flags(void) } if (!(hwcaps & 0x01)) - ODP_PRINT("%s ", hwcap_flags[i].feat_flag); + _ODP_PRINT("%s ", hwcap_flags[i].feat_flag); hwcaps = hwcaps >> 1; } } @@ -950,26 +950,26 @@ static void _odp_sys_info_print_hwcap_flags(void) for (unsigned long i = 0; i < size2; i++) { if (hwcap2_flags[i].valid) { if (!(hwcaps2 & 0x01)) - ODP_PRINT("%s ", hwcap2_flags[i].feat_flag); + _ODP_PRINT("%s ", hwcap2_flags[i].feat_flag); hwcaps2 = hwcaps2 >> 1; } } - ODP_PRINT("\n"); + _ODP_PRINT("\n"); - ODP_PRINT("\nARM FEATURES NOT SUPPORTED BY KERNEL:\n"); + _ODP_PRINT("\nARM FEATURES NOT SUPPORTED BY KERNEL:\n"); for (unsigned long i = 0; i < size; i++) { if (!hwcap_flags[i].valid) - ODP_PRINT("%s ", hwcap_flags[i].feat_flag); + _ODP_PRINT("%s ", hwcap_flags[i].feat_flag); } for (unsigned long i = 0; i < size2; i++) { if (!hwcap2_flags[i].valid) - ODP_PRINT("%s ", hwcap2_flags[i].feat_flag); + _ODP_PRINT("%s ", hwcap2_flags[i].feat_flag); } - ODP_PRINT("\n\n"); + _ODP_PRINT("\n\n"); } void _odp_cpu_flags_print_all(void) diff --git a/platform/linux-generic/arch/aarch64/odp_crypto_armv8.c b/platform/linux-generic/arch/aarch64/odp_crypto_armv8.c index 0b791c8b6..11fadc971 100644 --- a/platform/linux-generic/arch/aarch64/odp_crypto_armv8.c +++ b/platform/linux-generic/arch/aarch64/odp_crypto_armv8.c @@ -216,7 +216,7 @@ null_crypto_routine(odp_packet_t pkt ODP_UNUSED, static inline void copy_aad(uint8_t *dst, uint8_t *src, uint32_t len) { - ODP_ASSERT(len == 8 || len == 12); + _ODP_ASSERT(len == 8 || len == 12); /* Use constant length memcpy for better optimization result */ if (len == 8) @@ -248,7 +248,7 @@ void aes_gcm_encrypt(odp_packet_t pkt, /* Fail early if cipher_range is too large */ if (odp_unlikely(in_len > ARM_CRYPTO_MAX_DATA_LENGTH)) { - ODP_DBG("ARM Crypto: Packet size too large for requested operation\n"); + _ODP_DBG("ARM Crypto: Packet size too large for requested operation\n"); goto err; } @@ -261,14 +261,14 @@ void aes_gcm_encrypt(odp_packet_t pkt, goto err; #else iv_ptr = param->cipher_iv_ptr; - ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); + _ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); #endif cs.constants = &session->cc; rc = armv8_aes_gcm_set_counter(iv_ptr, iv_bit_length, &cs); if (odp_unlikely(rc)) { - ODP_DBG("ARM Crypto: Failure while setting nonce\n"); + _ODP_DBG("ARM Crypto: Failure while setting nonce\n"); goto err; } @@ -302,7 +302,7 @@ void aes_gcm_encrypt(odp_packet_t pkt, data, tag); if (odp_unlikely(rc)) { - ODP_DBG("ARM Crypto: AES GCM Encoding failed\n"); + _ODP_DBG("ARM Crypto: AES GCM Encoding failed\n"); goto err; } @@ -348,7 +348,7 @@ void aes_gcm_decrypt(odp_packet_t pkt, /* Fail early if cipher_range is too large */ if (odp_unlikely(in_len > ARM_CRYPTO_MAX_DATA_LENGTH)) { - ODP_DBG("ARM Crypto: Packet size too large for requested operation\n"); + _ODP_DBG("ARM Crypto: Packet size too large for requested operation\n"); goto err; } @@ -361,14 +361,14 @@ void aes_gcm_decrypt(odp_packet_t pkt, goto err; #else iv_ptr = param->cipher_iv_ptr; - ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); + _ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); #endif cs.constants = &session->cc; rc = armv8_aes_gcm_set_counter(iv_ptr, iv_bit_length, &cs); if (odp_unlikely(rc)) { - ODP_DBG("ARM Crypto: Failure while setting nonce\n"); + _ODP_DBG("ARM Crypto: Failure while setting nonce\n"); goto err; } @@ -406,7 +406,7 @@ void aes_gcm_decrypt(odp_packet_t pkt, tag, data); if (odp_unlikely(rc)) { - ODP_DBG("ARM Crypto: AES GCM Decoding failed\n"); + _ODP_DBG("ARM Crypto: AES GCM Decoding failed\n"); goto err; } @@ -547,7 +547,7 @@ odp_crypto_session_create(const odp_crypto_session_param_t *param, odp_crypto_generic_session_t *session; if (odp_global_ro.disable.crypto) { - ODP_ERR("Crypto is disabled\n"); + _ODP_ERR("Crypto is disabled\n"); /* Dummy output to avoid compiler warning about uninitialized * variables */ *status = ODP_CRYPTO_SES_ERR_ENOMEM; @@ -566,13 +566,13 @@ odp_crypto_session_create(const odp_crypto_session_param_t *param, session->p = *param; if (session->p.cipher_iv_len > ARM_CRYPTO_MAX_IV_LENGTH) { - ODP_DBG("Maximum IV length exceeded\n"); + _ODP_DBG("Maximum IV length exceeded\n"); *status = ODP_CRYPTO_SES_ERR_CIPHER; goto err; } if (session->p.auth_iv_len > ARM_CRYPTO_MAX_IV_LENGTH) { - ODP_DBG("Maximum auth IV length exceeded\n"); + _ODP_DBG("Maximum auth IV length exceeded\n"); *status = ODP_CRYPTO_SES_ERR_CIPHER; goto err; } @@ -624,7 +624,7 @@ odp_crypto_session_create(const odp_crypto_session_param_t *param, session->p.auth_digest_len, session->p.cipher_key.data, &session->cc) != 0) { - ODP_DBG("ARM Crypto: Failure in setting constants\n"); + _ODP_DBG("ARM Crypto: Failure in setting constants\n"); rc = -1; } rc = process_aes_gcm_param(session); @@ -756,7 +756,7 @@ int _odp_crypto_init_global(void) int idx; if (odp_global_ro.disable.crypto) { - ODP_PRINT("\nODP crypto is DISABLED\n"); + _ODP_PRINT("\nODP crypto is DISABLED\n"); return 0; } @@ -768,7 +768,7 @@ int _odp_crypto_init_global(void) ODP_CACHE_LINE_SIZE, 0); if (ODP_SHM_INVALID == shm) { - ODP_ERR("unable to allocate crypto pool\n"); + _ODP_ERR("unable to allocate crypto pool\n"); return -1; } @@ -800,13 +800,13 @@ int _odp_crypto_term_global(void) for (session = global->free; session != NULL; session = session->next) count++; if (count != MAX_SESSIONS) { - ODP_ERR("crypto sessions still active\n"); + _ODP_ERR("crypto sessions still active\n"); rc = -1; } ret = odp_shm_free(odp_shm_lookup("_odp_crypto_pool_armv8crypto")); if (ret < 0) { - ODP_ERR("shm free failed for _odp_crypto_pool_armv8crypto\n"); + _ODP_ERR("shm free failed for _odp_crypto_pool_armv8crypto\n"); rc = -1; } @@ -833,7 +833,7 @@ odp_crypto_compl_t odp_crypto_compl_from_event(odp_event_t ev) { /* This check not mandated by the API specification */ if (odp_event_type(ev) != ODP_EVENT_CRYPTO_COMPL) - ODP_ABORT("Event not a crypto completion"); + _ODP_ABORT("Event not a crypto completion"); return (odp_crypto_compl_t)ev; } @@ -850,7 +850,7 @@ odp_crypto_compl_result(odp_crypto_compl_t completion_event, (void)result; /* We won't get such events anyway, so there can be no result */ - ODP_ASSERT(0); + _ODP_ASSERT(0); } void @@ -880,8 +880,8 @@ uint64_t odp_crypto_session_to_u64(odp_crypto_session_t hdl) odp_packet_t odp_crypto_packet_from_event(odp_event_t ev) { /* This check not mandated by the API specification */ - ODP_ASSERT(odp_event_type(ev) == ODP_EVENT_PACKET); - ODP_ASSERT(odp_event_subtype(ev) == ODP_EVENT_PACKET_CRYPTO); + _ODP_ASSERT(odp_event_type(ev) == ODP_EVENT_PACKET); + _ODP_ASSERT(odp_event_subtype(ev) == ODP_EVENT_PACKET_CRYPTO); return odp_packet_from_event(ev); } @@ -896,7 +896,7 @@ int odp_crypto_result(odp_crypto_packet_result_t *result, { odp_crypto_packet_result_t *op_result; - ODP_ASSERT(odp_event_subtype(odp_packet_to_event(packet)) == + _ODP_ASSERT(odp_event_subtype(odp_packet_to_event(packet)) == ODP_EVENT_PACKET_CRYPTO); op_result = get_op_result_from_packet(packet); @@ -914,13 +914,13 @@ static int copy_data_and_metadata(odp_packet_t dst, odp_packet_t src) md_copy = _odp_packet_copy_md_possible(odp_packet_pool(dst), odp_packet_pool(src)); if (odp_unlikely(md_copy < 0)) { - ODP_ERR("Unable to copy packet metadata\n"); + _ODP_ERR("Unable to copy packet metadata\n"); return -1; } rc = odp_packet_copy_from_pkt(dst, 0, src, 0, odp_packet_len(src)); if (odp_unlikely(rc < 0)) { - ODP_ERR("Unable to copy packet data\n"); + _ODP_ERR("Unable to copy packet data\n"); return -1; } @@ -940,7 +940,7 @@ static odp_packet_t get_output_packet(const odp_crypto_generic_session_t *sessio if (pkt_out == ODP_PACKET_INVALID) { odp_pool_t pool = session->p.output_pool; - ODP_ASSERT(pool != ODP_POOL_INVALID); + _ODP_ASSERT(pool != ODP_POOL_INVALID); if (pool == odp_packet_pool(pkt_in)) { pkt_out = pkt_in; } else { @@ -993,7 +993,7 @@ int odp_crypto_op(const odp_packet_t pkt_in[], for (i = 0; i < num_pkt; i++) { session = (odp_crypto_generic_session_t *)(intptr_t)param[i].session; - ODP_ASSERT(ODP_CRYPTO_SYNC == session->p.op_mode); + _ODP_ASSERT(ODP_CRYPTO_SYNC == session->p.op_mode); rc = crypto_int(pkt_in[i], &pkt_out[i], ¶m[i]); if (rc < 0) @@ -1015,8 +1015,8 @@ int odp_crypto_op_enq(const odp_packet_t pkt_in[], for (i = 0; i < num_pkt; i++) { session = (odp_crypto_generic_session_t *)(intptr_t)param[i].session; - ODP_ASSERT(ODP_CRYPTO_ASYNC == session->p.op_mode); - ODP_ASSERT(ODP_QUEUE_INVALID != session->p.compl_queue); + _ODP_ASSERT(ODP_CRYPTO_ASYNC == session->p.op_mode); + _ODP_ASSERT(ODP_QUEUE_INVALID != session->p.compl_queue); pkt = pkt_out[i]; rc = crypto_int(pkt_in[i], &pkt, ¶m[i]); diff --git a/platform/linux-generic/arch/aarch64/odp_llsc.h b/platform/linux-generic/arch/aarch64/odp_llsc.h index 1c2610511..ba7a447d4 100644 --- a/platform/linux-generic/arch/aarch64/odp_llsc.h +++ b/platform/linux-generic/arch/aarch64/odp_llsc.h @@ -30,7 +30,7 @@ static inline uint16_t ll8(uint8_t *var, int mm) : "r" (var) : ); else - ODP_ABORT(); + _ODP_ABORT(); return old; } @@ -49,7 +49,7 @@ static inline uint32_t ll32(uint32_t *var, int mm) : "r" (var) : ); else - ODP_ABORT(); + _ODP_ABORT(); return old; } @@ -69,7 +69,7 @@ static inline uint32_t sc32(uint32_t *var, uint32_t neu, int mm) : "r" (neu), "r" (var) : ); else - ODP_ABORT(); + _ODP_ABORT(); return ret; } @@ -88,7 +88,7 @@ static inline uint64_t ll(uint64_t *var, int mm) : "r" (var) : ); else - ODP_ABORT(); + _ODP_ABORT(); return old; } @@ -110,7 +110,7 @@ static inline uint32_t sc(uint64_t *var, uint64_t neu, int mm) : "r" (neu), "r" (var) : ); else - ODP_ABORT(); + _ODP_ABORT(); return ret; } @@ -136,7 +136,7 @@ static inline _odp_u128_t lld(_odp_u128_t *var, int mm) : "r" (var) : ); else - ODP_ABORT(); + _ODP_ABORT(); return old.i128; } @@ -162,7 +162,7 @@ static inline uint32_t scd(_odp_u128_t *var, _odp_u128_t neu, int mm) "r" (var) : ); else - ODP_ABORT(); + _ODP_ABORT(); #pragma GCC diagnostic pop return ret; } diff --git a/platform/linux-generic/arch/aarch64/odp_sysinfo_parse.c b/platform/linux-generic/arch/aarch64/odp_sysinfo_parse.c index 921bafaf0..25e3e4fc6 100644 --- a/platform/linux-generic/arch/aarch64/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/aarch64/odp_sysinfo_parse.c @@ -336,7 +336,7 @@ int _odp_cpuinfo_parser(FILE *file, system_info_t *sysinfo) if (sysinfo->cpu_hz_max[id] == 0) { uint64_t hz = sysinfo->default_cpu_hz_max; - ODP_PRINT("WARN: cpu[%i] uses default max " + _ODP_PRINT("WARN: cpu[%i] uses default max " "frequency of %" PRIu64 " Hz from " "config file\n", id, hz); sysinfo->cpu_hz_max[id] = hz; diff --git a/platform/linux-generic/arch/default/odp_cpu_cycles.c b/platform/linux-generic/arch/default/odp_cpu_cycles.c index 5d0d5db1d..41436a672 100644 --- a/platform/linux-generic/arch/default/odp_cpu_cycles.c +++ b/platform/linux-generic/arch/default/odp_cpu_cycles.c @@ -28,7 +28,7 @@ uint64_t _odp_cpu_cycles(void) ret = clock_gettime(CLOCK_MONOTONIC_RAW, &time); if (ret != 0) - ODP_ABORT("clock_gettime failed\n"); + _ODP_ABORT("clock_gettime failed\n"); hz = odp_global_ro.system_info.cpu_hz_max[0]; diff --git a/platform/linux-generic/arch/x86/cpu_flags.c b/platform/linux-generic/arch/x86/cpu_flags.c index c75a87233..036645dbc 100644 --- a/platform/linux-generic/arch/x86/cpu_flags.c +++ b/platform/linux-generic/arch/x86/cpu_flags.c @@ -356,7 +356,7 @@ void _odp_cpu_flags_print_all(void) len += snprintf(&str[len], max_len - len, "\n\n"); str[len] = '\0'; - ODP_PRINT("%s", str); + _ODP_PRINT("%s", str); } int _odp_cpu_has_global_time(void) diff --git a/platform/linux-generic/arch/x86/odp_cpu_cycles.c b/platform/linux-generic/arch/x86/odp_cpu_cycles.c index 406668a79..2624af0f6 100644 --- a/platform/linux-generic/arch/x86/odp_cpu_cycles.c +++ b/platform/linux-generic/arch/x86/odp_cpu_cycles.c @@ -13,7 +13,7 @@ int _odp_cpu_cycles_init_global(void) { if (_odp_cpu_flags_has_rdtsc() == 0) { - ODP_ERR("RDTSC instruction not supported\n"); + _ODP_ERR("RDTSC instruction not supported\n"); return -1; } diff --git a/platform/linux-generic/arch/x86/odp_global_time.c b/platform/linux-generic/arch/x86/odp_global_time.c index d4d7ab150..00e3a1ac1 100644 --- a/platform/linux-generic/arch/x86/odp_global_time.c +++ b/platform/linux-generic/arch/x86/odp_global_time.c @@ -34,19 +34,19 @@ uint64_t _odp_cpu_global_time_freq(void) sleep.tv_nsec = SEC_IN_NS / 4; if (clock_gettime(CLOCK_MONOTONIC_RAW, &ts1)) { - ODP_DBG("clock_gettime failed\n"); + _ODP_DBG("clock_gettime failed\n"); return 0; } t1 = _odp_cpu_global_time(); if (nanosleep(&sleep, NULL) < 0) { - ODP_DBG("nanosleep failed\n"); + _ODP_DBG("nanosleep failed\n"); return 0; } if (clock_gettime(CLOCK_MONOTONIC_RAW, &ts2)) { - ODP_DBG("clock_gettime failed\n"); + _ODP_DBG("clock_gettime failed\n"); return 0; } diff --git a/platform/linux-generic/include/odp/api/plat/debug_inlines.h b/platform/linux-generic/include/odp/api/plat/debug_inlines.h index 93344e616..bada48f9b 100644 --- a/platform/linux-generic/include/odp/api/plat/debug_inlines.h +++ b/platform/linux-generic/include/odp/api/plat/debug_inlines.h @@ -93,14 +93,6 @@ extern odp_abort_func_t _odp_abort_fn; #define _ODP_PRINT(fmt, ...) \ _ODP_LOG_FN(ODP_LOG_PRINT, fmt, ##__VA_ARGS__) -/* Temp defines for backwards compatibility */ -#define ODP_ASSERT _ODP_ASSERT -#define ODP_DBG _ODP_DBG -#define ODP_ERR _ODP_ERR -#define ODP_ABORT _ODP_ABORT -#define ODP_ASSERT _ODP_ASSERT -#define ODP_PRINT _ODP_PRINT - #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/include/odp_classification_internal.h b/platform/linux-generic/include/odp_classification_internal.h index dd1f8aaf6..c3ecf4079 100644 --- a/platform/linux-generic/include/odp_classification_internal.h +++ b/platform/linux-generic/include/odp_classification_internal.h @@ -62,7 +62,7 @@ static inline void _odp_cos_queue_stats_add(cos_t *cos, odp_queue_t queue, int queue_idx = _odp_cos_queue_idx(cos, queue); if (odp_unlikely(queue_idx < 0)) { - ODP_ERR("Queue not attached to the CoS\n"); + _ODP_ERR("Queue not attached to the CoS\n"); return; } diff --git a/platform/linux-generic/include/odp_llqueue.h b/platform/linux-generic/include/odp_llqueue.h index 6340d111a..29810ebf3 100644 --- a/platform/linux-generic/include/odp_llqueue.h +++ b/platform/linux-generic/include/odp_llqueue.h @@ -84,7 +84,7 @@ static inline void llq_enqueue(struct llqueue *llq, struct llnode *node) { union llht old, neu; - ODP_ASSERT(node->next == NULL); + _ODP_ASSERT(node->next == NULL); node->next = SENTINEL; do { old.ui = lld(&llq->u.ui, __ATOMIC_RELAXED); @@ -93,7 +93,7 @@ static inline void llq_enqueue(struct llqueue *llq, struct llnode *node) } while (odp_unlikely(scd(&llq->u.ui, neu.ui, __ATOMIC_RELEASE))); if (old.st.tail != NULL) { /* List was not empty */ - ODP_ASSERT(old.st.tail->next == SENTINEL); + _ODP_ASSERT(old.st.tail->next == SENTINEL); old.st.tail->next = node; } } @@ -230,7 +230,7 @@ static inline void llqueue_init(struct llqueue *llq) static inline void llq_enqueue(struct llqueue *llq, struct llnode *node) { - ODP_ASSERT(node->next == NULL); + _ODP_ASSERT(node->next == NULL); node->next = SENTINEL; odp_spinlock_lock(&llq->lock); @@ -257,11 +257,11 @@ static inline struct llnode *llq_dequeue(struct llqueue *llq) if (llq->head != NULL) { node = llq->head; if (llq->head == llq->tail) { - ODP_ASSERT(node->next == SENTINEL); + _ODP_ASSERT(node->next == SENTINEL); llq->head = NULL; llq->tail = NULL; } else { - ODP_ASSERT(node->next != SENTINEL); + _ODP_ASSERT(node->next != SENTINEL); llq->head = node->next; } node->next = NULL; @@ -279,11 +279,11 @@ static inline odp_bool_t llq_dequeue_cond(struct llqueue *llq, if (odp_likely(llq->head != NULL && llq->head == node)) { success = true; if (llq->head == llq->tail) { - ODP_ASSERT(node->next == SENTINEL); + _ODP_ASSERT(node->next == SENTINEL); llq->head = NULL; llq->tail = NULL; } else { - ODP_ASSERT(node->next != SENTINEL); + _ODP_ASSERT(node->next != SENTINEL); llq->head = node->next; } node->next = NULL; @@ -302,7 +302,7 @@ static inline odp_bool_t llq_cond_rotate(struct llqueue *llq, if (odp_likely(llq->head == node)) { success = true; if (llq->tail != node) { - ODP_ASSERT(node->next != SENTINEL); + _ODP_ASSERT(node->next != SENTINEL); llq->head = node->next; llq->tail->next = node; llq->tail = node; diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 7b207afec..a6a8c551c 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -342,8 +342,8 @@ static inline void _odp_packet_copy_md(odp_packet_hdr_t *dst_hdr, const uint32_t src_uarea_size = src_pool->param_uarea_size; const uint32_t dst_uarea_size = dst_pool->param_uarea_size; - ODP_ASSERT(dst_hdr->uarea_addr != NULL); - ODP_ASSERT(dst_uarea_size >= src_uarea_size); + _ODP_ASSERT(dst_hdr->uarea_addr != NULL); + _ODP_ASSERT(dst_uarea_size >= src_uarea_size); memcpy(dst_hdr->uarea_addr, src_hdr->uarea_addr, src_uarea_size); } else { @@ -351,7 +351,7 @@ static inline void _odp_packet_copy_md(odp_packet_hdr_t *dst_hdr, /* If user area exists, packets should always be from the same pool, so * user area pointers can simply be swapped. */ - ODP_ASSERT(dst_hdr->event_hdr.pool == src_hdr->event_hdr.pool); + _ODP_ASSERT(dst_hdr->event_hdr.pool == src_hdr->event_hdr.pool); src_hdr->uarea_addr = dst_hdr->uarea_addr; dst_hdr->uarea_addr = src_uarea; diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index 04a7ea286..844088ac1 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -268,8 +268,8 @@ static inline pktio_entry_t *get_pktio_entry(odp_pktio_t pktio) return NULL; if (odp_unlikely(_odp_typeval(pktio) > ODP_CONFIG_PKTIO_ENTRIES)) { - ODP_DBG("pktio limit %" PRIuPTR "/%d exceed\n", - _odp_typeval(pktio), ODP_CONFIG_PKTIO_ENTRIES); + _ODP_DBG("pktio limit %" PRIuPTR "/%d exceed\n", + _odp_typeval(pktio), ODP_CONFIG_PKTIO_ENTRIES); return NULL; } diff --git a/platform/linux-generic/include/odp_queue_scalable_internal.h b/platform/linux-generic/include/odp_queue_scalable_internal.h index f7fc94e71..dccc2aef9 100644 --- a/platform/linux-generic/include/odp_queue_scalable_internal.h +++ b/platform/linux-generic/include/odp_queue_scalable_internal.h @@ -67,7 +67,7 @@ static inline void *shm_pool_alloc_align(_odp_ishm_pool_t *pool, uint32_t size) void *addr; addr = _odp_ishm_pool_alloc(pool, _ODP_ROUNDUP_CACHE_LINE(size)); - ODP_ASSERT(((uintptr_t)addr & (ODP_CACHE_LINE_SIZE - 1)) == 0); + _ODP_ASSERT(((uintptr_t)addr & (ODP_CACHE_LINE_SIZE - 1)) == 0); return addr; } diff --git a/platform/linux-generic/include/odp_sysinfo_internal.h b/platform/linux-generic/include/odp_sysinfo_internal.h index 16e4ced84..0fef1aa32 100644 --- a/platform/linux-generic/include/odp_sysinfo_internal.h +++ b/platform/linux-generic/include/odp_sysinfo_internal.h @@ -27,9 +27,9 @@ static inline int _odp_dummy_cpuinfo(system_info_t *sysinfo) sysinfo->cpu_arch = ODP_CPU_ARCH_UNKNOWN; - ODP_DBG("Warning: use dummy values for freq and model string\n"); + _ODP_DBG("Warning: use dummy values for freq and model string\n"); for (i = 0; i < CONFIG_NUM_CPU_IDS; i++) { - ODP_PRINT("WARN: cpu[%i] uses default max frequency of " + _ODP_PRINT("WARN: cpu[%i] uses default max frequency of " "%" PRIu64 " Hz from config file\n", i, cpu_hz_max); sysinfo->cpu_hz_max[i] = cpu_hz_max; strcpy(sysinfo->model_str[i], "UNKNOWN"); diff --git a/platform/linux-generic/odp_buffer.c b/platform/linux-generic/odp_buffer.c index 278aa8147..e82e2b23e 100644 --- a/platform/linux-generic/odp_buffer.c +++ b/platform/linux-generic/odp_buffer.c @@ -39,7 +39,7 @@ void odp_buffer_print(odp_buffer_t buf) char str[max_len]; if (!odp_buffer_is_valid(buf)) { - ODP_ERR("Buffer is not valid.\n"); + _ODP_ERR("Buffer is not valid.\n"); return; } @@ -53,7 +53,7 @@ void odp_buffer_print(odp_buffer_t buf) len += snprintf(&str[len], n - len, " size %u\n", odp_buffer_size(buf)); str[len] = 0; - ODP_PRINT("\n%s\n", str); + _ODP_PRINT("\n%s\n", str); } uint64_t odp_buffer_to_u64(odp_buffer_t hdl) diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c index ed0f6723d..0730ba055 100644 --- a/platform/linux-generic/odp_classification.c +++ b/platform/linux-generic/odp_classification.c @@ -124,7 +124,7 @@ int _odp_classification_init_global(void) int _odp_classification_term_global(void) { if (_odp_cls_global && odp_shm_free(_odp_cls_global->shm)) { - ODP_ERR("shm free failed\n"); + _ODP_ERR("shm free failed\n"); return -1; } @@ -258,19 +258,19 @@ odp_cos_t odp_cls_cos_create(const char *name, const odp_cls_cos_param_t *param_ odp_pool_info_t pool_info; if (pool == ODP_POOL_INVALID || odp_pool_info(pool, &pool_info)) { - ODP_ERR("invalid packet vector pool\n"); + _ODP_ERR("invalid packet vector pool\n"); return ODP_COS_INVALID; } if (pool_info.params.type != ODP_POOL_VECTOR) { - ODP_ERR("wrong pool type\n"); + _ODP_ERR("wrong pool type\n"); return ODP_COS_INVALID; } if (param.vector.max_size == 0) { - ODP_ERR("vector.max_size is zero\n"); + _ODP_ERR("vector.max_size is zero\n"); return ODP_COS_INVALID; } if (param.vector.max_size > pool_info.params.vector.max_size) { - ODP_ERR("vector.max_size larger than pool max vector size\n"); + _ODP_ERR("vector.max_size larger than pool max vector size\n"); return ODP_COS_INVALID; } } @@ -347,7 +347,7 @@ odp_cos_t odp_cls_cos_create(const char *name, const odp_cls_cos_param_t *param_ UNLOCK(&cos->lock); } - ODP_ERR("CLS_COS_MAX_ENTRY reached\n"); + _ODP_ERR("CLS_COS_MAX_ENTRY reached\n"); return ODP_COS_INVALID; } @@ -371,7 +371,7 @@ odp_pmr_t alloc_pmr(pmr_t **pmr) } UNLOCK(&pmr_tbl->pmr[i].lock); } - ODP_ERR("CLS_PMR_MAX_ENTRY reached\n"); + _ODP_ERR("CLS_PMR_MAX_ENTRY reached\n"); return ODP_PMR_INVALID; } @@ -405,7 +405,7 @@ int odp_cos_destroy(odp_cos_t cos_id) cos_t *cos = get_cos_entry(cos_id); if (NULL == cos) { - ODP_ERR("Invalid odp_cos_t handle\n"); + _ODP_ERR("Invalid odp_cos_t handle\n"); return -1; } @@ -421,12 +421,12 @@ int odp_cos_queue_set(odp_cos_t cos_id, odp_queue_t queue_id) cos_t *cos = get_cos_entry(cos_id); if (cos == NULL) { - ODP_ERR("Invalid odp_cos_t handle\n"); + _ODP_ERR("Invalid odp_cos_t handle\n"); return -1; } if (cos->num_queue != 1) { - ODP_ERR("Hashing enabled, cannot set queue\n"); + _ODP_ERR("Hashing enabled, cannot set queue\n"); return -1; } @@ -441,7 +441,7 @@ odp_queue_t odp_cos_queue(odp_cos_t cos_id) cos_t *cos = get_cos_entry(cos_id); if (!cos) { - ODP_ERR("Invalid odp_cos_t handle\n"); + _ODP_ERR("Invalid odp_cos_t handle\n"); return ODP_QUEUE_INVALID; } @@ -453,7 +453,7 @@ uint32_t odp_cls_cos_num_queue(odp_cos_t cos_id) cos_t *cos = get_cos_entry(cos_id); if (!cos) { - ODP_ERR("Invalid odp_cos_t handle\n"); + _ODP_ERR("Invalid odp_cos_t handle\n"); return 0; } @@ -470,7 +470,7 @@ uint32_t odp_cls_cos_queues(odp_cos_t cos_id, odp_queue_t queue[], cos = get_cos_entry(cos_id); if (!cos) { - ODP_ERR("Invalid odp_cos_t handle\n"); + _ODP_ERR("Invalid odp_cos_t handle\n"); return 0; } @@ -499,7 +499,7 @@ int odp_cos_drop_set(odp_cos_t cos_id, odp_cls_drop_t drop_policy) cos_t *cos = get_cos_entry(cos_id); if (!cos) { - ODP_ERR("Invalid odp_cos_t handle\n"); + _ODP_ERR("Invalid odp_cos_t handle\n"); return -1; } @@ -513,7 +513,7 @@ odp_cls_drop_t odp_cos_drop(odp_cos_t cos_id) cos_t *cos = get_cos_entry(cos_id); if (!cos) { - ODP_ERR("Invalid odp_cos_t handle\n"); + _ODP_ERR("Invalid odp_cos_t handle\n"); return -1; } @@ -527,12 +527,12 @@ int odp_pktio_default_cos_set(odp_pktio_t pktio_in, odp_cos_t default_cos) entry = get_pktio_entry(pktio_in); if (entry == NULL) { - ODP_ERR("Invalid odp_pktio_t handle\n"); + _ODP_ERR("Invalid odp_pktio_t handle\n"); return -1; } cos = get_cos_entry(default_cos); if (cos == NULL) { - ODP_ERR("Invalid odp_cos_t handle\n"); + _ODP_ERR("Invalid odp_cos_t handle\n"); return -1; } @@ -547,13 +547,13 @@ int odp_pktio_error_cos_set(odp_pktio_t pktio_in, odp_cos_t error_cos) entry = get_pktio_entry(pktio_in); if (entry == NULL) { - ODP_ERR("Invalid odp_pktio_t handle\n"); + _ODP_ERR("Invalid odp_pktio_t handle\n"); return -1; } cos = get_cos_entry(error_cos); if (cos == NULL) { - ODP_ERR("Invalid odp_cos_t handle\n"); + _ODP_ERR("Invalid odp_cos_t handle\n"); return -1; } @@ -575,7 +575,7 @@ int odp_pktio_headroom_set(odp_pktio_t pktio_in, uint32_t headroom) pktio_entry_t *entry = get_pktio_entry(pktio_in); if (entry == NULL) { - ODP_ERR("Invalid odp_pktio_t handle\n"); + _ODP_ERR("Invalid odp_pktio_t handle\n"); return -1; } entry->cls.headroom = headroom; @@ -593,7 +593,7 @@ int odp_cos_with_l2_priority(odp_pktio_t pktio_in, pktio_entry_t *entry = get_pktio_entry(pktio_in); if (entry == NULL) { - ODP_ERR("Invalid odp_pktio_t handle\n"); + _ODP_ERR("Invalid odp_pktio_t handle\n"); return -1; } l2_cos = &entry->cls.l2_cos_table; @@ -620,7 +620,7 @@ int ODP_DEPRECATE(odp_cos_with_l3_qos)(odp_pktio_t pktio_in, uint32_t num_qos, u cos_t *cos; if (entry == NULL) { - ODP_ERR("Invalid odp_pktio_t handle\n"); + _ODP_ERR("Invalid odp_pktio_t handle\n"); return -1; } @@ -649,7 +649,7 @@ static int pmr_create_term(pmr_term_value_t *value, odp_cls_pmr_term_t term = param->term; if (param->range_term) { - ODP_ERR("PMR value range not supported\n"); + _ODP_ERR("PMR value range not supported\n"); return -1; } @@ -713,13 +713,13 @@ static int pmr_create_term(pmr_term_value_t *value, break; default: - ODP_ERR("Bad PMR term\n"); + _ODP_ERR("Bad PMR term\n"); return -1; } if ((!custom && param->val_sz != size) || (custom && param->val_sz > size)) { - ODP_ERR("Bad PMR value size: %u\n", param->val_sz); + _ODP_ERR("Bad PMR value size: %u\n", param->val_sz); return -1; } @@ -776,12 +776,12 @@ static odp_pmr_t cls_pmr_create(const odp_pmr_param_t *terms, int num_terms, uin cos_t *cos_dst = get_cos_entry(dst_cos); if (NULL == cos_src || NULL == cos_dst) { - ODP_ERR("Invalid odp_cos_t handle\n"); + _ODP_ERR("Invalid odp_cos_t handle\n"); return ODP_PMR_INVALID; } if (num_terms > CLS_PMRTERM_MAX) { - ODP_ERR("no of terms greater than supported CLS_PMRTERM_MAX\n"); + _ODP_ERR("no of terms greater than supported CLS_PMRTERM_MAX\n"); return ODP_PMR_INVALID; } @@ -823,12 +823,12 @@ odp_pmr_t odp_cls_pmr_create_opt(const odp_pmr_create_opt_t *opt, odp_cos_t src_cos, odp_cos_t dst_cos) { if (opt == NULL) { - ODP_ERR("Bad parameter\n"); + _ODP_ERR("Bad parameter\n"); return ODP_PMR_INVALID; } if (opt->mark > MAX_MARK) { - ODP_ERR("Too large mark value: %" PRIu64 "\n", opt->mark); + _ODP_ERR("Too large mark value: %" PRIu64 "\n", opt->mark); return ODP_PMR_INVALID; } @@ -841,7 +841,7 @@ int odp_cls_cos_pool_set(odp_cos_t cos_id, odp_pool_t pool) cos = get_cos_entry(cos_id); if (cos == NULL) { - ODP_ERR("Invalid odp_cos_t handle\n"); + _ODP_ERR("Invalid odp_cos_t handle\n"); return -1; } @@ -856,7 +856,7 @@ odp_pool_t odp_cls_cos_pool(odp_cos_t cos_id) cos = get_cos_entry(cos_id); if (cos == NULL) { - ODP_ERR("Invalid odp_cos_t handle\n"); + _ODP_ERR("Invalid odp_cos_t handle\n"); return ODP_POOL_INVALID; } @@ -1199,7 +1199,7 @@ static inline int verify_pmr_custom_frame(const uint8_t *pkt_addr, uint32_t offset = term_value->offset; uint32_t val_sz = term_value->val_sz; - ODP_ASSERT(val_sz <= MAX_PMR_TERM_SIZE); + _ODP_ASSERT(val_sz <= MAX_PMR_TERM_SIZE); if (packet_len(pkt_hdr) <= offset + val_sz) return 0; @@ -1226,7 +1226,7 @@ static inline int verify_pmr_custom_l3(const uint8_t *pkt_addr, uint32_t offset = l3_offset + term_value->offset; uint32_t val_sz = term_value->val_sz; - ODP_ASSERT(val_sz <= MAX_PMR_TERM_SIZE); + _ODP_ASSERT(val_sz <= MAX_PMR_TERM_SIZE); if (pkt_hdr->p.input_flags.l2 == 0 || l3_offset == ODP_PACKET_OFFSET_INVALID) @@ -1907,12 +1907,12 @@ int odp_cls_cos_stats(odp_cos_t hdl, odp_cls_cos_stats_t *stats) cos_t *cos = get_cos_entry(hdl); if (odp_unlikely(cos == NULL)) { - ODP_ERR("Invalid odp_cos_t handle\n"); + _ODP_ERR("Invalid odp_cos_t handle\n"); return -1; } if (odp_unlikely(stats == NULL)) { - ODP_ERR("Output structure NULL\n"); + _ODP_ERR("Output structure NULL\n"); return -1; } @@ -1930,18 +1930,18 @@ int odp_cls_queue_stats(odp_cos_t hdl, odp_queue_t queue, int queue_idx; if (odp_unlikely(cos == NULL)) { - ODP_ERR("Invalid odp_cos_t handle\n"); + _ODP_ERR("Invalid odp_cos_t handle\n"); return -1; } if (odp_unlikely(stats == NULL)) { - ODP_ERR("Output structure NULL\n"); + _ODP_ERR("Output structure NULL\n"); return -1; } queue_idx = _odp_cos_queue_idx(cos, queue); if (odp_unlikely(queue_idx < 0)) { - ODP_ERR("Invalid odp_queue_t handle\n"); + _ODP_ERR("Invalid odp_queue_t handle\n"); return -1; } @@ -1956,10 +1956,9 @@ static void print_cos_ident(cos_t *cos) { if (strlen(cos->name)) - ODP_PRINT("%s", cos->name); + _ODP_PRINT("%s", cos->name); - ODP_PRINT("(%" PRIu64 ")\n", - odp_cos_to_u64(_odp_cos_from_ndx(cos->index))); + _ODP_PRINT("(%" PRIu64 ")\n", odp_cos_to_u64(_odp_cos_from_ndx(cos->index))); } static @@ -1968,9 +1967,9 @@ void print_queue_ident(odp_queue_t q) odp_queue_info_t info; if (!odp_queue_info(q, &info) && strlen(info.name)) - ODP_PRINT(" %s\n", info.name); + _ODP_PRINT(" %s\n", info.name); else - ODP_PRINT(" %" PRIx64 "\n", odp_queue_to_u64(q)); + _ODP_PRINT(" %" PRIx64 "\n", odp_queue_to_u64(q)); } static @@ -1979,7 +1978,7 @@ void print_hex(const void *vp, int len) const uint8_t *p = vp; for (int i = 0; i < len; i++) - ODP_PRINT("%02x", *p++); + _ODP_PRINT("%02x", *p++); } static @@ -1989,9 +1988,9 @@ void cls_print_cos(cos_t *cos) uint32_t num_rule = odp_atomic_load_u32(&cos->num_rule); bool first = true; - ODP_PRINT("cos: "); + _ODP_PRINT("cos: "); print_cos_ident(cos); - ODP_PRINT(" queues:\n"); + _ODP_PRINT(" queues:\n"); if (!cos->queue_group) { print_queue_ident(cos->queue); @@ -2008,30 +2007,30 @@ void cls_print_cos(cos_t *cos) pmr_term_value_t *v = &pmr->pmr_term_value[k]; if (first) - ODP_PRINT(" rules: "); + _ODP_PRINT(" rules: "); else - ODP_PRINT(" "); + _ODP_PRINT(" "); first = false; - ODP_PRINT("%s: ", format_pmr_name(v->term)); + _ODP_PRINT("%s: ", format_pmr_name(v->term)); if (v->term == ODP_PMR_CUSTOM_FRAME || v->term == ODP_PMR_CUSTOM_L3) - ODP_PRINT("offset:%" PRIu32 " ", v->offset); + _ODP_PRINT("offset:%" PRIu32 " ", v->offset); if (v->range_term) { - ODP_PRINT("<range>"); + _ODP_PRINT("<range>"); } else { print_hex(v->match.value_u8, v->val_sz); - ODP_PRINT(" "); + _ODP_PRINT(" "); print_hex(v->match.mask_u8, v->val_sz); } - ODP_PRINT(" -> "); + _ODP_PRINT(" -> "); if (pmr->mark) - ODP_PRINT("mark:%" PRIu16 " ", pmr->mark); + _ODP_PRINT("mark:%" PRIu16 " ", pmr->mark); print_cos_ident(cos->linked_cos[j]); } @@ -2041,7 +2040,7 @@ void cls_print_cos(cos_t *cos) void odp_cls_print_all(void) { - ODP_PRINT("\n" + _ODP_PRINT("\n" "Classifier info\n" "---------------\n\n"); diff --git a/platform/linux-generic/odp_comp.c b/platform/linux-generic/odp_comp.c index 7a5b0198b..13999457f 100644 --- a/platform/linux-generic/odp_comp.c +++ b/platform/linux-generic/odp_comp.c @@ -135,14 +135,14 @@ static void process_input(odp_packet_t pkt_out, do { out_data = odp_packet_offset(pkt_out, start, &out_len, &cur_seg); - ODP_DBG("out_data %p seg_data_ptr %p out_len %d seg %p\n", - (void *)out_data, odp_packet_seg_data(pkt_out, cur_seg), - out_len, (void *)cur_seg); + _ODP_DBG("out_data %p seg_data_ptr %p out_len %d seg %p\n", + (void *)out_data, odp_packet_seg_data(pkt_out, cur_seg), + out_len, (void *)cur_seg); if (0 == out_len) { /* there are no more segments */ - ODP_DBG("Ran out of space. (streamp->avail_out) %d\n", - (streamp->avail_out)); + _ODP_DBG("Ran out of space. (streamp->avail_out) %d\n", + (streamp->avail_out)); result->status = ODP_COMP_STATUS_OUT_OF_SPACE_TERM; break; } @@ -156,12 +156,9 @@ static void process_input(odp_packet_t pkt_out, streamp->next_out = out_data; streamp->avail_out = out_len; - ODP_DBG("next_in %p, avail_in %d next_out %p" - " avail_out %d, sync %d\n", - (const void *)streamp->next_in, streamp->avail_in, - (void *)streamp->next_out, - streamp->avail_out, - sync); + _ODP_DBG("next_in %p, avail_in %d next_out %p avail_out %d, sync %d\n", + (const void *)streamp->next_in, streamp->avail_in, + (void *)streamp->next_out, streamp->avail_out, sync); if (session->params.op == ODP_COMP_OP_COMPRESS) ret = mz_deflate(streamp, @@ -169,8 +166,8 @@ static void process_input(odp_packet_t pkt_out, else ret = mz_inflate(streamp, MZ_NO_FLUSH); - ODP_DBG("ret %d streamp->avail_out %d avail_in %d\n", - ret, streamp->avail_out, streamp->avail_in); + _ODP_DBG("ret %d streamp->avail_out %d avail_in %d\n", + ret, streamp->avail_out, streamp->avail_in); out_len = out_len - streamp->avail_out; written += out_len; @@ -182,7 +179,7 @@ static void process_input(odp_packet_t pkt_out, start += out_len; space_avail -= out_len; - ODP_DBG("ret %d,written %d\n", ret, out_len); + _ODP_DBG("ret %d,written %d\n", ret, out_len); if (ret == MZ_STREAM_END) { if (session->params.op == ODP_COMP_OP_COMPRESS) { @@ -196,7 +193,7 @@ static void process_input(odp_packet_t pkt_out, break; } if ((ret != MZ_BUF_ERROR) && (ret != MZ_OK)) { - ODP_DBG("deflate failed. Err %s,ret %d" + _ODP_DBG("deflate failed. Err %s,ret %d" "(streamp->avail_out) %d\n", streamp->msg, ret, (streamp->avail_out)); result->status = ODP_COMP_STATUS_FAILURE; @@ -210,7 +207,7 @@ static void process_input(odp_packet_t pkt_out, /* if write stopped as output exhausted, return OUT_OF_SPACE_ERR */ - ODP_DBG("Ran out of space. (out avail) %d," + _ODP_DBG("Ran out of space. (out avail) %d," "to process %d\n", streamp->avail_out, streamp->avail_in); result->status = ODP_COMP_STATUS_OUT_OF_SPACE_TERM; @@ -239,10 +236,10 @@ static int deflate_comp(odp_packet_t pkt_in, odp_packet_seg_t in_seg = ODP_PACKET_SEG_INVALID; odp_comp_packet_result_t *result = get_op_result_from_packet(pkt_out); - ODP_ASSERT(session != NULL); - ODP_ASSERT(params != NULL); - ODP_ASSERT(pkt_in != ODP_PACKET_INVALID); - ODP_ASSERT(pkt_out != ODP_PACKET_INVALID); + _ODP_ASSERT(session != NULL); + _ODP_ASSERT(params != NULL); + _ODP_ASSERT(pkt_in != ODP_PACKET_INVALID); + _ODP_ASSERT(pkt_out != ODP_PACKET_INVALID); streamp = &session->comp.stream; @@ -260,8 +257,8 @@ static int deflate_comp(odp_packet_t pkt_in, read, &in_len, &in_seg); - ODP_DBG("data %p in_len %d seg %p len %d\n", - (void *)data, in_len, (void *)in_seg, len); + _ODP_DBG("data %p in_len %d seg %p len %d\n", + (void *)data, in_len, (void *)in_seg, len); if (in_len > len) in_len = len; @@ -272,7 +269,7 @@ static int deflate_comp(odp_packet_t pkt_in, streamp->avail_in = in_len; if (consumed >= len) { - ODP_DBG("This is last chunk\n"); + _ODP_DBG("This is last chunk\n"); sync = true; } @@ -284,9 +281,7 @@ static int deflate_comp(odp_packet_t pkt_in, read += in_len; } - ODP_DBG("Read %d Written %d\n", - read, - result->output_data_range.length); + _ODP_DBG("Read %d Written %d\n", read, result->output_data_range.length); return 0; } @@ -316,7 +311,7 @@ static int deflate_init(odp_comp_generic_session_t *session) odp_comp_huffman_code_t cc; /* optional check as such may not required */ - ODP_ASSERT(strcmp(mz_version(), MZ_VERSION) == 0); + _ODP_ASSERT(strcmp(mz_version(), MZ_VERSION) == 0); memset(&session->comp.stream, 0, sizeof(mz_stream)); @@ -358,20 +353,17 @@ static int deflate_init(odp_comp_generic_session_t *session) default: return -1; } - ODP_DBG(" level %d strategy %d window %d\n", - level, strategy, window_bits); + _ODP_DBG(" level %d strategy %d window %d\n", level, strategy, window_bits); if (ODP_COMP_OP_COMPRESS == session->params.op) { if (mz_deflateInit2(streamp, level, MZ_DEFLATED, window_bits, MEM_LEVEL, strategy) != MZ_OK) { - ODP_DBG("Err in Deflate Initialization %s\n", - streamp->msg); + _ODP_DBG("Err in Deflate Initialization %s\n", streamp->msg); return -1; } } else { if (mz_inflateInit2(streamp, window_bits) != MZ_OK) { - ODP_DBG("Err in Inflate Initialization %s\n", - streamp->msg); + _ODP_DBG("Err in Inflate Initialization %s\n", streamp->msg); return -1; } } @@ -390,14 +382,13 @@ static int term_def(odp_comp_generic_session_t *session) rc = mz_deflateEnd(streamp); if (rc != MZ_OK) { - ODP_ERR("deflateEnd failed. Err %s,rc %d\n", - streamp->msg, rc); + _ODP_ERR("deflateEnd failed. Err %s,rc %d\n", streamp->msg, rc); /* we choose to just return 0 with error info */ } } else { rc = mz_inflateEnd(streamp); if (rc != MZ_OK) { - ODP_ERR("inflateEnd failed. Err %s\n", streamp->msg); + _ODP_ERR("inflateEnd failed. Err %s\n", streamp->msg); /* we choose to just return 0 with error info */ } } @@ -459,7 +450,7 @@ int odp_comp_session_destroy(odp_comp_session_t session) break; } if (rc < 0) { - ODP_ERR("Compression Unit could not be terminated\n"); + _ODP_ERR("Compression Unit could not be terminated\n"); return -1; } @@ -533,12 +524,12 @@ static int _odp_comp_single(odp_packet_t pkt_in, odp_packet_t pkt_out, int rc; session = to_gen_session(param->session); - ODP_ASSERT(session); - ODP_ASSERT(pkt_in != ODP_PACKET_INVALID); - ODP_ASSERT(pkt_out != ODP_PACKET_INVALID); + _ODP_ASSERT(session); + _ODP_ASSERT(pkt_in != ODP_PACKET_INVALID); + _ODP_ASSERT(pkt_out != ODP_PACKET_INVALID); result = get_op_result_from_packet(pkt_out); - ODP_ASSERT(result); + _ODP_ASSERT(result); result->pkt_in = pkt_in; result->output_data_range.offset = param->out_data_range.offset; @@ -598,11 +589,11 @@ int odp_comp_result(odp_comp_packet_result_t *result, { odp_comp_packet_result_t *op_result; - ODP_ASSERT(odp_event_subtype(odp_packet_to_event(packet)) + _ODP_ASSERT(odp_event_subtype(odp_packet_to_event(packet)) == ODP_EVENT_PACKET_COMP); op_result = get_op_result_from_packet(packet); - ODP_DBG("Copy operational result back\n"); + _ODP_DBG("Copy operational result back\n"); memcpy(result, op_result, sizeof(*result)); return 0; } @@ -614,7 +605,7 @@ int _odp_comp_init_global(void) int idx; if (odp_global_ro.disable.compress) { - ODP_PRINT("\nODP compress is DISABLED\n"); + _ODP_PRINT("\nODP compress is DISABLED\n"); return 0; } @@ -655,13 +646,13 @@ int _odp_comp_term_global(void) count++; if (count != MAX_SESSIONS) { - ODP_ERR("comp sessions still active\n"); + _ODP_ERR("comp sessions still active\n"); rc = -1; } ret = odp_shm_free(global->global_shm); if (ret < 0) { - ODP_ERR("shm free failed for comp_pool\n"); + _ODP_ERR("shm free failed for comp_pool\n"); rc = -1; } @@ -671,8 +662,8 @@ int _odp_comp_term_global(void) odp_packet_t odp_comp_packet_from_event(odp_event_t ev) { /* This check not mandated by the API specification */ - ODP_ASSERT(odp_event_type(ev) == ODP_EVENT_PACKET); - ODP_ASSERT(odp_event_subtype(ev) == ODP_EVENT_PACKET_COMP); + _ODP_ASSERT(odp_event_type(ev) == ODP_EVENT_PACKET); + _ODP_ASSERT(odp_event_subtype(ev) == ODP_EVENT_PACKET_COMP); return odp_packet_from_event(ev); } diff --git a/platform/linux-generic/odp_cpumask.c b/platform/linux-generic/odp_cpumask.c index be792e82a..d0a9953f7 100644 --- a/platform/linux-generic/odp_cpumask.c +++ b/platform/linux-generic/odp_cpumask.c @@ -238,7 +238,7 @@ static int get_available_cpus(void) ret = sched_getaffinity(0, sizeof(cpuset), &cpuset); if (ret < 0) { - ODP_ERR("Failed to get cpu affinity"); + _ODP_ERR("Failed to get cpu affinity"); return -1; } diff --git a/platform/linux-generic/odp_crypto_null.c b/platform/linux-generic/odp_crypto_null.c index 981c9239c..b9d319861 100644 --- a/platform/linux-generic/odp_crypto_null.c +++ b/platform/linux-generic/odp_crypto_null.c @@ -116,7 +116,7 @@ void free_session(odp_crypto_generic_session_t *session) int odp_crypto_capability(odp_crypto_capability_t *capa) { if (odp_global_ro.disable.crypto) { - ODP_ERR("Crypto is disabled\n"); + _ODP_ERR("Crypto is disabled\n"); return -1; } @@ -198,7 +198,7 @@ odp_crypto_session_create(const odp_crypto_session_param_t *param, odp_crypto_generic_session_t *session; if (odp_global_ro.disable.crypto) { - ODP_ERR("Crypto is disabled\n"); + _ODP_ERR("Crypto is disabled\n"); /* Dummy output to avoid compiler warning about uninitialized * variables */ *status = ODP_CRYPTO_SES_CREATE_ERR_ENOMEM; @@ -333,7 +333,7 @@ _odp_crypto_init_global(void) int idx; if (odp_global_ro.disable.crypto) { - ODP_PRINT("\nODP crypto is DISABLED\n"); + _ODP_PRINT("\nODP crypto is DISABLED\n"); return 0; } @@ -345,7 +345,7 @@ _odp_crypto_init_global(void) ODP_CACHE_LINE_SIZE, 0); if (ODP_SHM_INVALID == shm) { - ODP_ERR("unable to allocate crypto pool\n"); + _ODP_ERR("unable to allocate crypto pool\n"); return -1; } @@ -377,13 +377,13 @@ int _odp_crypto_term_global(void) for (session = global->free; session != NULL; session = session->next) count++; if (count != MAX_SESSIONS) { - ODP_ERR("crypto sessions still active\n"); + _ODP_ERR("crypto sessions still active\n"); rc = -1; } ret = odp_shm_free(odp_shm_lookup("_odp_crypto_null_global")); if (ret < 0) { - ODP_ERR("shm free failed for _odp_crypto_pool_null\n"); + _ODP_ERR("shm free failed for _odp_crypto_pool_null\n"); rc = -1; } @@ -405,7 +405,7 @@ odp_crypto_compl_t odp_crypto_compl_from_event(odp_event_t ev) { /* This check not mandated by the API specification */ if (odp_event_type(ev) != ODP_EVENT_CRYPTO_COMPL) - ODP_ABORT("Event not a crypto completion"); + _ODP_ABORT("Event not a crypto completion"); return (odp_crypto_compl_t)ev; } @@ -422,7 +422,7 @@ odp_crypto_compl_result(odp_crypto_compl_t completion_event, (void)result; /* We won't get such events anyway, so there can be no result */ - ODP_ASSERT(0); + _ODP_ASSERT(0); } void @@ -452,8 +452,8 @@ uint64_t odp_crypto_session_to_u64(odp_crypto_session_t hdl) odp_packet_t odp_crypto_packet_from_event(odp_event_t ev) { /* This check not mandated by the API specification */ - ODP_ASSERT(odp_event_type(ev) == ODP_EVENT_PACKET); - ODP_ASSERT(odp_event_subtype(ev) == ODP_EVENT_PACKET_CRYPTO); + _ODP_ASSERT(odp_event_type(ev) == ODP_EVENT_PACKET); + _ODP_ASSERT(odp_event_subtype(ev) == ODP_EVENT_PACKET_CRYPTO); return odp_packet_from_event(ev); } @@ -476,7 +476,7 @@ int odp_crypto_result(odp_crypto_packet_result_t *result, { odp_crypto_packet_result_t *op_result; - ODP_ASSERT(odp_event_subtype(odp_packet_to_event(packet)) == + _ODP_ASSERT(odp_event_subtype(odp_packet_to_event(packet)) == ODP_EVENT_PACKET_CRYPTO); op_result = get_op_result_from_packet(packet); @@ -494,13 +494,13 @@ static int copy_data_and_metadata(odp_packet_t dst, odp_packet_t src) md_copy = _odp_packet_copy_md_possible(odp_packet_pool(dst), odp_packet_pool(src)); if (odp_unlikely(md_copy < 0)) { - ODP_ERR("Unable to copy packet metadata\n"); + _ODP_ERR("Unable to copy packet metadata\n"); return -1; } rc = odp_packet_copy_from_pkt(dst, 0, src, 0, odp_packet_len(src)); if (odp_unlikely(rc < 0)) { - ODP_ERR("Unable to copy packet data\n"); + _ODP_ERR("Unable to copy packet data\n"); return -1; } @@ -520,7 +520,7 @@ static odp_packet_t get_output_packet(const odp_crypto_generic_session_t *sessio if (pkt_out == ODP_PACKET_INVALID) { odp_pool_t pool = session->p.output_pool; - ODP_ASSERT(pool != ODP_POOL_INVALID); + _ODP_ASSERT(pool != ODP_POOL_INVALID); if (pool == odp_packet_pool(pkt_in)) { pkt_out = pkt_in; } else { @@ -578,7 +578,7 @@ int odp_crypto_op(const odp_packet_t pkt_in[], for (i = 0; i < num_pkt; i++) { session = (odp_crypto_generic_session_t *)(intptr_t)param[i].session; - ODP_ASSERT(ODP_CRYPTO_SYNC == session->p.op_mode); + _ODP_ASSERT(ODP_CRYPTO_SYNC == session->p.op_mode); rc = crypto_int(pkt_in[i], &pkt_out[i], ¶m[i]); if (rc < 0) @@ -600,8 +600,8 @@ int odp_crypto_op_enq(const odp_packet_t pkt_in[], for (i = 0; i < num_pkt; i++) { session = (odp_crypto_generic_session_t *)(intptr_t)param[i].session; - ODP_ASSERT(ODP_CRYPTO_ASYNC == session->p.op_mode); - ODP_ASSERT(ODP_QUEUE_INVALID != session->p.compl_queue); + _ODP_ASSERT(ODP_CRYPTO_ASYNC == session->p.op_mode); + _ODP_ASSERT(ODP_QUEUE_INVALID != session->p.compl_queue); pkt = pkt_out[i]; rc = crypto_int(pkt_in[i], &pkt, ¶m[i]); diff --git a/platform/linux-generic/odp_crypto_openssl.c b/platform/linux-generic/odp_crypto_openssl.c index 9b5ea4612..e593d91e7 100644 --- a/platform/linux-generic/odp_crypto_openssl.c +++ b/platform/linux-generic/odp_crypto_openssl.c @@ -384,7 +384,7 @@ void packet_hmac(odp_packet_t pkt, uint32_t offset = param->auth_range.offset; uint32_t len = param->auth_range.length; - ODP_ASSERT(offset + len <= odp_packet_len(pkt)); + _ODP_ASSERT(offset + len <= odp_packet_len(pkt)); /* Reinitialize HMAC calculation without resetting the key */ HMAC_Init_ex(ctx, NULL, 0, NULL, NULL); @@ -434,9 +434,9 @@ void packet_aes_xcbc_mac(odp_packet_t pkt, void *mapaddr; uint8_t *data = NULL; - ODP_ASSERT(offset + len <= odp_packet_len(pkt)); - ODP_ASSERT(session != NULL); - ODP_ASSERT(sizeof(session->auth.key) >= 3 * AES_KEY_LENGTH); + _ODP_ASSERT(offset + len <= odp_packet_len(pkt)); + _ODP_ASSERT(session != NULL); + _ODP_ASSERT(sizeof(session->auth.key) >= 3 * AES_KEY_LENGTH); ctx = EVP_CIPHER_CTX_new(); EVP_EncryptInit_ex(ctx, session->auth.evp_cipher, @@ -639,7 +639,7 @@ void packet_cmac(odp_packet_t pkt, uint32_t len = param->auth_range.length; size_t outlen; - ODP_ASSERT(offset + len <= odp_packet_len(pkt)); + _ODP_ASSERT(offset + len <= odp_packet_len(pkt)); /* Reinitialize CMAC calculation without resetting the key */ CMAC_Init(ctx, NULL, 0, NULL, NULL); @@ -724,10 +724,10 @@ int packet_cmac_eia2(odp_packet_t pkt, return ODP_CRYPTO_ALG_ERR_IV_INVALID; #else iv_ptr = param->auth_iv_ptr; - ODP_ASSERT(session->p.auth_iv_len == 0 || iv_ptr != NULL); + _ODP_ASSERT(session->p.auth_iv_len == 0 || iv_ptr != NULL); #endif - ODP_ASSERT(offset + len <= odp_packet_len(pkt)); + _ODP_ASSERT(offset + len <= odp_packet_len(pkt)); /* Reinitialize CMAC calculation without resetting the key */ CMAC_Init(ctx, NULL, 0, NULL, NULL); @@ -814,7 +814,7 @@ void packet_digest(odp_packet_t pkt, uint32_t offset = param->auth_range.offset; uint32_t len = param->auth_range.length; - ODP_ASSERT(offset + len <= odp_packet_len(pkt)); + _ODP_ASSERT(offset + len <= odp_packet_len(pkt)); EVP_DigestInit_ex(ctx, session->auth.evp_md, @@ -892,7 +892,7 @@ int internal_aad(EVP_CIPHER_CTX *ctx, int dummy_len; int ret; - ODP_ASSERT(offset + len <= odp_packet_len(pkt)); + _ODP_ASSERT(offset + len <= odp_packet_len(pkt)); while (len > 0) { uint32_t seglen = 0; /* GCC */ @@ -935,7 +935,7 @@ static inline int internal_crypt(EVP_CIPHER_CTX *ctx, int out_len; int rc; - ODP_ASSERT(in_pos + in_len <= odp_packet_len(pkt)); + _ODP_ASSERT(in_pos + in_len <= odp_packet_len(pkt)); /* * In the following loop we process one packet segment per iteration. @@ -1002,7 +1002,7 @@ static inline int internal_crypt(EVP_CIPHER_CTX *ctx, continue; } } - ODP_ASSERT(buffered == 0); + _ODP_ASSERT(buffered == 0); if (in_len > 0) { /* @@ -1014,7 +1014,7 @@ static inline int internal_crypt(EVP_CIPHER_CTX *ctx, rc = EVP_update(ctx, in_addr, &out_len, in_addr, len); if (odp_unlikely(rc != 1)) goto err; - ODP_ASSERT(_ODP_CHECK_IS_POWER2(block_len)); + _ODP_ASSERT(_ODP_CHECK_IS_POWER2(block_len)); buffered = len & (block_len - 1); if (odp_unlikely(out_len + buffered != len)) goto err; @@ -1034,7 +1034,7 @@ static inline int internal_crypt(EVP_CIPHER_CTX *ctx, return 0; return rc; err: - ODP_ERR("internal error\n"); + _ODP_ERR("internal error\n"); (void)EVP_final(ctx, block, &out_len); return 0; } @@ -1085,7 +1085,7 @@ odp_crypto_alg_err_t cipher_encrypt(odp_packet_t pkt, return ODP_CRYPTO_ALG_ERR_IV_INVALID; #else iv_ptr = param->cipher_iv_ptr; - ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); + _ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); #endif EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv_ptr); @@ -1124,7 +1124,7 @@ odp_crypto_alg_err_t cipher_decrypt(odp_packet_t pkt, return ODP_CRYPTO_ALG_ERR_IV_INVALID; #else iv_ptr = param->cipher_iv_ptr; - ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); + _ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); #endif EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv_ptr); @@ -1192,7 +1192,7 @@ odp_crypto_alg_err_t cipher_encrypt_bits(odp_packet_t pkt, return ODP_CRYPTO_ALG_ERR_IV_INVALID; #else iv_ptr = param->cipher_iv_ptr; - ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); + _ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); #endif EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv_ptr); @@ -1236,7 +1236,7 @@ odp_crypto_alg_err_t cipher_decrypt_bits(odp_packet_t pkt, return ODP_CRYPTO_ALG_ERR_IV_INVALID; #else iv_ptr = param->cipher_iv_ptr; - ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); + _ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); #endif EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv_ptr); @@ -1317,7 +1317,7 @@ odp_crypto_alg_err_t aes_gcm_encrypt(odp_packet_t pkt, return ODP_CRYPTO_ALG_ERR_IV_INVALID; #else iv_ptr = param->cipher_iv_ptr; - ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); + _ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); #endif EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv_ptr); @@ -1372,7 +1372,7 @@ odp_crypto_alg_err_t aes_gcm_decrypt(odp_packet_t pkt, return ODP_CRYPTO_ALG_ERR_IV_INVALID; #else iv_ptr = param->cipher_iv_ptr; - ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); + _ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); #endif EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv_ptr); @@ -1453,7 +1453,7 @@ odp_crypto_alg_err_t aes_gmac_gen(odp_packet_t pkt, return ODP_CRYPTO_ALG_ERR_IV_INVALID; #else iv_ptr = param->auth_iv_ptr; - ODP_ASSERT(session->p.auth_iv_len == 0 || iv_ptr != NULL); + _ODP_ASSERT(session->p.auth_iv_len == 0 || iv_ptr != NULL); #endif EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv_ptr); @@ -1500,7 +1500,7 @@ odp_crypto_alg_err_t aes_gmac_check(odp_packet_t pkt, return ODP_CRYPTO_ALG_ERR_IV_INVALID; #else iv_ptr = param->auth_iv_ptr; - ODP_ASSERT(session->p.auth_iv_len == 0 || iv_ptr != NULL); + _ODP_ASSERT(session->p.auth_iv_len == 0 || iv_ptr != NULL); #endif EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv_ptr); @@ -1585,7 +1585,7 @@ odp_crypto_alg_err_t aes_ccm_encrypt(odp_packet_t pkt, return ODP_CRYPTO_ALG_ERR_IV_INVALID; #else iv_ptr = param->cipher_iv_ptr; - ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); + _ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); #endif EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_TAG, @@ -1657,7 +1657,7 @@ odp_crypto_alg_err_t aes_ccm_decrypt(odp_packet_t pkt, return ODP_CRYPTO_ALG_ERR_IV_INVALID; #else iv_ptr = param->cipher_iv_ptr; - ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); + _ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); #endif odp_packet_copy_to_mem(pkt, param->hash_result_offset, @@ -1741,7 +1741,7 @@ odp_crypto_alg_err_t xts_encrypt(odp_packet_t pkt, return ODP_CRYPTO_ALG_ERR_IV_INVALID; #else iv_ptr = param->cipher_iv_ptr; - ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); + _ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); #endif EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv_ptr); @@ -1783,7 +1783,7 @@ odp_crypto_alg_err_t xts_decrypt(odp_packet_t pkt, return ODP_CRYPTO_ALG_ERR_IV_INVALID; #else iv_ptr = param->cipher_iv_ptr; - ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); + _ODP_ASSERT(session->p.cipher_iv_len == 0 || iv_ptr != NULL); #endif EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv_ptr); @@ -1947,7 +1947,7 @@ static int process_digest_param(odp_crypto_generic_session_t *session, int odp_crypto_capability(odp_crypto_capability_t *capa) { if (odp_global_ro.disable.crypto) { - ODP_ERR("Crypto is disabled\n"); + _ODP_ERR("Crypto is disabled\n"); return -1; } @@ -2194,7 +2194,7 @@ odp_crypto_session_create(const odp_crypto_session_param_t *param, odp_crypto_generic_session_t *session; if (odp_global_ro.disable.crypto) { - ODP_ERR("Crypto is disabled\n"); + _ODP_ERR("Crypto is disabled\n"); /* Dummy output to avoid compiler warning about uninitialized * variables */ *status = ODP_CRYPTO_SES_ERR_ENOMEM; @@ -2223,13 +2223,13 @@ odp_crypto_session_create(const odp_crypto_session_param_t *param, session->p = *param; if (session->p.cipher_iv_len > EVP_MAX_IV_LENGTH) { - ODP_DBG("Maximum IV length exceeded\n"); + _ODP_DBG("Maximum IV length exceeded\n"); *status = ODP_CRYPTO_SES_ERR_CIPHER; goto err; } if (session->p.auth_iv_len > EVP_MAX_IV_LENGTH) { - ODP_DBG("Maximum auth IV length exceeded\n"); + _ODP_DBG("Maximum auth IV length exceeded\n"); *status = ODP_CRYPTO_SES_ERR_CIPHER; goto err; } @@ -2599,7 +2599,7 @@ int _odp_crypto_init_global(void) int nlocks = CRYPTO_num_locks(); if (odp_global_ro.disable.crypto) { - ODP_PRINT("\nODP crypto is DISABLED\n"); + _ODP_PRINT("\nODP crypto is DISABLED\n"); return 0; } @@ -2612,7 +2612,7 @@ int _odp_crypto_init_global(void) ODP_CACHE_LINE_SIZE, 0); if (ODP_SHM_INVALID == shm) { - ODP_ERR("unable to allocate crypto pool\n"); + _ODP_ERR("unable to allocate crypto pool\n"); return -1; } @@ -2654,7 +2654,7 @@ int _odp_crypto_term_global(void) for (session = global->free; session != NULL; session = session->next) count++; if (count != MAX_SESSIONS) { - ODP_ERR("crypto sessions still active\n"); + _ODP_ERR("crypto sessions still active\n"); rc = -1; } @@ -2665,7 +2665,7 @@ int _odp_crypto_term_global(void) ret = odp_shm_free(odp_shm_lookup("_odp_crypto_ssl_global")); if (ret < 0) { - ODP_ERR("shm free failed for crypto_pool\n"); + _ODP_ERR("shm free failed for crypto_pool\n"); rc = -1; } @@ -2734,7 +2734,7 @@ odp_crypto_compl_t odp_crypto_compl_from_event(odp_event_t ev) { /* This check not mandated by the API specification */ if (odp_event_type(ev) != ODP_EVENT_CRYPTO_COMPL) - ODP_ABORT("Event not a crypto completion"); + _ODP_ABORT("Event not a crypto completion"); return (odp_crypto_compl_t)ev; } @@ -2751,7 +2751,7 @@ odp_crypto_compl_result(odp_crypto_compl_t completion_event, (void)result; /* We won't get such events anyway, so there can be no result */ - ODP_ASSERT(0); + _ODP_ASSERT(0); } void @@ -2781,8 +2781,8 @@ uint64_t odp_crypto_session_to_u64(odp_crypto_session_t hdl) odp_packet_t odp_crypto_packet_from_event(odp_event_t ev) { /* This check not mandated by the API specification */ - ODP_ASSERT(odp_event_type(ev) == ODP_EVENT_PACKET); - ODP_ASSERT(odp_event_subtype(ev) == ODP_EVENT_PACKET_CRYPTO); + _ODP_ASSERT(odp_event_type(ev) == ODP_EVENT_PACKET); + _ODP_ASSERT(odp_event_subtype(ev) == ODP_EVENT_PACKET_CRYPTO); return odp_packet_from_event(ev); } @@ -2805,7 +2805,7 @@ int odp_crypto_result(odp_crypto_packet_result_t *result, { odp_crypto_packet_result_t *op_result; - ODP_ASSERT(odp_event_subtype(odp_packet_to_event(packet)) == + _ODP_ASSERT(odp_event_subtype(odp_packet_to_event(packet)) == ODP_EVENT_PACKET_CRYPTO); op_result = get_op_result_from_packet(packet); @@ -2823,13 +2823,13 @@ static int copy_data_and_metadata(odp_packet_t dst, odp_packet_t src) md_copy = _odp_packet_copy_md_possible(odp_packet_pool(dst), odp_packet_pool(src)); if (odp_unlikely(md_copy < 0)) { - ODP_ERR("Unable to copy packet metadata\n"); + _ODP_ERR("Unable to copy packet metadata\n"); return -1; } rc = odp_packet_copy_from_pkt(dst, 0, src, 0, odp_packet_len(src)); if (odp_unlikely(rc < 0)) { - ODP_ERR("Unable to copy packet data\n"); + _ODP_ERR("Unable to copy packet data\n"); return -1; } @@ -2849,7 +2849,7 @@ static odp_packet_t get_output_packet(const odp_crypto_generic_session_t *sessio if (pkt_out == ODP_PACKET_INVALID) { odp_pool_t pool = session->p.output_pool; - ODP_ASSERT(pool != ODP_POOL_INVALID); + _ODP_ASSERT(pool != ODP_POOL_INVALID); if (pool == odp_packet_pool(pkt_in)) { pkt_out = pkt_in; } else { @@ -2922,7 +2922,7 @@ int odp_crypto_op(const odp_packet_t pkt_in[], for (i = 0; i < num_pkt; i++) { session = (odp_crypto_generic_session_t *)(intptr_t)param[i].session; - ODP_ASSERT(ODP_CRYPTO_SYNC == session->p.op_mode); + _ODP_ASSERT(ODP_CRYPTO_SYNC == session->p.op_mode); rc = crypto_int(pkt_in[i], &pkt_out[i], ¶m[i]); if (rc < 0) @@ -2944,8 +2944,8 @@ int odp_crypto_op_enq(const odp_packet_t pkt_in[], for (i = 0; i < num_pkt; i++) { session = (odp_crypto_generic_session_t *)(intptr_t)param[i].session; - ODP_ASSERT(ODP_CRYPTO_ASYNC == session->p.op_mode); - ODP_ASSERT(ODP_QUEUE_INVALID != session->p.compl_queue); + _ODP_ASSERT(ODP_CRYPTO_ASYNC == session->p.op_mode); + _ODP_ASSERT(ODP_QUEUE_INVALID != session->p.compl_queue); pkt = pkt_out[i]; rc = crypto_int(pkt_in[i], &pkt, ¶m[i]); diff --git a/platform/linux-generic/odp_dma.c b/platform/linux-generic/odp_dma.c index 4c129c616..73d7d6cdc 100644 --- a/platform/linux-generic/odp_dma.c +++ b/platform/linux-generic/odp_dma.c @@ -79,7 +79,7 @@ static inline dma_session_t *dma_session_from_handle(odp_dma_t dma) int odp_dma_capability(odp_dma_capability_t *capa) { if (odp_global_ro.disable.dma) { - ODP_ERR("DMA is disabled\n"); + _ODP_ERR("DMA is disabled\n"); return -1; } @@ -131,7 +131,7 @@ static odp_stash_t create_stash(void) stash = odp_stash_create("_odp_dma_transfer_id", &stash_param); if (stash == ODP_STASH_INVALID) { - ODP_ERR("Stash create failed\n"); + _ODP_ERR("Stash create failed\n"); return ODP_STASH_INVALID; } @@ -139,7 +139,7 @@ static odp_stash_t create_stash(void) for (id = 1; id < MAX_TRANSFERS + 1; id++) { ret = odp_stash_put_u32(stash, &id, 1); if (ret != 1) { - ODP_ERR("Stash put failed: %i, %u\n", ret, id); + _ODP_ERR("Stash put failed: %i, %u\n", ret, id); break; } } @@ -147,13 +147,13 @@ static odp_stash_t create_stash(void) if (ret != 1) { for (i = 0; i < id; i++) { if (odp_stash_get_u32(stash, &tmp, 1) != 1) { - ODP_ERR("Stash get failed: %u\n", i); + _ODP_ERR("Stash get failed: %u\n", i); break; } } if (odp_stash_destroy(stash)) - ODP_ERR("Stash destroy failed\n"); + _ODP_ERR("Stash destroy failed\n"); return ODP_STASH_INVALID; } @@ -176,13 +176,13 @@ static int destroy_stash(odp_stash_t stash) if (num == 0) break; - ODP_ERR("Stash get failed: %i\n", num); + _ODP_ERR("Stash get failed: %i\n", num); ret = -1; break; } if (odp_stash_destroy(stash)) { - ODP_ERR("Stash destroy failed\n"); + _ODP_ERR("Stash destroy failed\n"); ret = -1; } @@ -196,28 +196,28 @@ odp_dma_t odp_dma_create(const char *name, const odp_dma_param_t *param) dma_session_t *session = NULL; if (odp_global_ro.disable.dma) { - ODP_ERR("DMA is disabled\n"); + _ODP_ERR("DMA is disabled\n"); return ODP_DMA_INVALID; } if ((param->direction != ODP_DMA_MAIN_TO_MAIN) || (param->type != ODP_DMA_TYPE_COPY)) { - ODP_ERR("Bad DMA parameter\n"); + _ODP_ERR("Bad DMA parameter\n"); return ODP_DMA_INVALID; } if (param->compl_mode_mask == 0) { - ODP_ERR("Empty compl mode mask\n"); + _ODP_ERR("Empty compl mode mask\n"); return ODP_DMA_INVALID; } if (odp_dma_capability(&dma_capa)) { - ODP_ERR("DMA capa failed\n"); + _ODP_ERR("DMA capa failed\n"); return ODP_DMA_INVALID; } if (param->compl_mode_mask & ~dma_capa.compl_mode_mask) { - ODP_ERR("Compl mode not supported\n"); + _ODP_ERR("Compl mode not supported\n"); return ODP_DMA_INVALID; } @@ -239,7 +239,7 @@ odp_dma_t odp_dma_create(const char *name, const odp_dma_param_t *param) } if (session == NULL) { - ODP_DBG("Out of DMA sessions\n"); + _ODP_DBG("Out of DMA sessions\n"); return ODP_DMA_INVALID; } @@ -271,7 +271,7 @@ int odp_dma_destroy(odp_dma_t dma) int ret = 0; if (dma == ODP_DMA_INVALID) { - ODP_ERR("Bad DMA handle\n"); + _ODP_ERR("Bad DMA handle\n"); return -1; } @@ -282,7 +282,7 @@ int odp_dma_destroy(odp_dma_t dma) odp_ticketlock_lock(&session->lock); if (session->active == 0) { - ODP_ERR("Session not created\n"); + _ODP_ERR("Session not created\n"); odp_ticketlock_unlock(&session->lock); return -1; } @@ -372,7 +372,7 @@ static inline int segment_pkt(segment_t seg[], int num_seg, const odp_dma_seg_t tot_len = dma_seg[i].len; if (odp_unlikely(offset + tot_len > odp_packet_len(pkt))) { - ODP_ERR("Bad packet segment len/offset (%u/%u)\n", tot_len, offset); + _ODP_ERR("Bad packet segment len/offset (%u/%u)\n", tot_len, offset); return 0; } @@ -380,7 +380,7 @@ static inline int segment_pkt(segment_t seg[], int num_seg, const odp_dma_seg_t addr = odp_packet_offset(pkt, offset, &seg_len, NULL); if (odp_unlikely(addr == NULL)) { - ODP_ERR("Bad packet offset %u\n", offset); + _ODP_ERR("Bad packet offset %u\n", offset); return 0; } @@ -396,7 +396,7 @@ static inline int segment_pkt(segment_t seg[], int num_seg, const odp_dma_seg_t num++; if (odp_unlikely(num >= MAX_SEGS)) { - ODP_ERR("Too many packet segments\n"); + _ODP_ERR("Too many packet segments\n"); return 0; } } @@ -474,29 +474,29 @@ int odp_dma_transfer(odp_dma_t dma, const odp_dma_transfer_param_t *transfer, segment_t dst[MAX_SEGS]; if (odp_unlikely(dma == ODP_DMA_INVALID)) { - ODP_ERR("Bad DMA handle\n"); + _ODP_ERR("Bad DMA handle\n"); return -1; } if (odp_unlikely(session->active == 0)) { - ODP_ERR("Session not created\n"); + _ODP_ERR("Session not created\n"); return -1; } if (odp_unlikely(transfer->num_src == 0 || transfer->num_src > MAX_SEGS)) { - ODP_ERR("Bad number of src segments\n"); + _ODP_ERR("Bad number of src segments\n"); return -1; } if (odp_unlikely(transfer->num_dst == 0 || transfer->num_dst > MAX_SEGS)) { - ODP_ERR("Bad number of dst segments\n"); + _ODP_ERR("Bad number of dst segments\n"); return -1; } tot_len = transfer_len(transfer); if (odp_unlikely(tot_len == 0)) { - ODP_ERR("Bad transfer length\n"); + _ODP_ERR("Bad transfer length\n"); return -1; } @@ -523,7 +523,7 @@ int odp_dma_transfer(odp_dma_t dma, const odp_dma_transfer_param_t *transfer, num = transfer_table(trs, src, dst, max_num, tot_len); if (odp_unlikely(num > max_num)) { - ODP_ERR("Segment table error\n"); + _ODP_ERR("Segment table error\n"); return -1; } @@ -546,7 +546,7 @@ int odp_dma_transfer_multi(odp_dma_t dma, const odp_dma_transfer_param_t *trs_pa int ret = 0; if (odp_unlikely(num < 1)) { - ODP_ERR("Bad number of transfers\n"); + _ODP_ERR("Bad number of transfers\n"); return -1; } @@ -597,7 +597,7 @@ void odp_dma_transfer_id_free(odp_dma_t dma, odp_dma_transfer_id_t transfer_id) num = odp_stash_put_u32(session->stash, &id, 1); if (odp_unlikely(num != 1)) - ODP_ERR("Stash put failed\n"); + _ODP_ERR("Stash put failed\n"); } static inline uint32_t index_from_transfer_id(odp_dma_transfer_id_t transfer_id) @@ -612,7 +612,7 @@ int odp_dma_transfer_start(odp_dma_t dma, const odp_dma_transfer_param_t *transf dma_session_t *session = dma_session_from_handle(dma); if (odp_unlikely(dma == ODP_DMA_INVALID)) { - ODP_ERR("Bad DMA handle\n"); + _ODP_ERR("Bad DMA handle\n"); return -1; } @@ -623,19 +623,19 @@ int odp_dma_transfer_start(odp_dma_t dma, const odp_dma_transfer_param_t *transf case ODP_DMA_COMPL_POLL: if (compl->transfer_id == ODP_DMA_TRANSFER_ID_INVALID || compl->transfer_id > MAX_TRANSFERS) { - ODP_ERR("Bad transfer ID: %u\n", compl->transfer_id); + _ODP_ERR("Bad transfer ID: %u\n", compl->transfer_id); return -1; } break; case ODP_DMA_COMPL_EVENT: if (compl->event == ODP_EVENT_INVALID || compl->queue == ODP_QUEUE_INVALID) { - ODP_ERR("Bad event or queue\n"); + _ODP_ERR("Bad event or queue\n"); return -1; } break; default: - ODP_ERR("Bad completion mode %u\n", compl->compl_mode); + _ODP_ERR("Bad completion mode %u\n", compl->compl_mode); return -1; } @@ -654,7 +654,7 @@ int odp_dma_transfer_start(odp_dma_t dma, const odp_dma_transfer_param_t *transf odp_buffer_t buf = (odp_buffer_t)(uintptr_t)compl->event; if (odp_unlikely(odp_event_type(compl->event) != ODP_EVENT_DMA_COMPL)) { - ODP_ERR("Bad completion event type\n"); + _ODP_ERR("Bad completion event type\n"); return -1; } @@ -663,8 +663,8 @@ int odp_dma_transfer_start(odp_dma_t dma, const odp_dma_transfer_param_t *transf result->user_ptr = compl->user_ptr; if (odp_unlikely(odp_queue_enq(compl->queue, compl->event))) { - ODP_ERR("Completion event enqueue failed %" PRIu64 "\n", - odp_queue_to_u64(compl->queue)); + _ODP_ERR("Completion event enqueue failed %" PRIu64 "\n", + odp_queue_to_u64(compl->queue)); return -1; } } @@ -679,7 +679,7 @@ int odp_dma_transfer_start_multi(odp_dma_t dma, const odp_dma_transfer_param_t * int ret = 0; if (odp_unlikely(num < 1)) { - ODP_ERR("Bad number of transfers\n"); + _ODP_ERR("Bad number of transfers\n"); return -1; } @@ -702,13 +702,13 @@ int odp_dma_transfer_done(odp_dma_t dma, odp_dma_transfer_id_t transfer_id, dma_session_t *session = dma_session_from_handle(dma); if (odp_unlikely(dma == ODP_DMA_INVALID)) { - ODP_ERR("Bad DMA handle\n"); + _ODP_ERR("Bad DMA handle\n"); return -1; } if (odp_unlikely(transfer_id == ODP_DMA_TRANSFER_ID_INVALID || transfer_id > MAX_TRANSFERS)) { - ODP_ERR("Bad transfer ID: %u\n", transfer_id); + _ODP_ERR("Bad transfer ID: %u\n", transfer_id); return -1; } @@ -737,13 +737,13 @@ odp_pool_t odp_dma_pool_create(const char *name, const odp_dma_pool_param_t *dma uint32_t cache_size = dma_pool_param->cache_size; if (num > _odp_dma_glb->pool_capa.buf.max_num) { - ODP_ERR("Too many DMA completion events: %u\n", num); + _ODP_ERR("Too many DMA completion events: %u\n", num); return ODP_POOL_INVALID; } if (cache_size < _odp_dma_glb->pool_capa.buf.min_cache_size || cache_size > _odp_dma_glb->pool_capa.buf.max_cache_size) { - ODP_ERR("Bad cache size: %u\n", cache_size); + _ODP_ERR("Bad cache size: %u\n", cache_size); return ODP_POOL_INVALID; } @@ -784,7 +784,7 @@ void odp_dma_compl_free(odp_dma_compl_t dma_compl) odp_buffer_t buf = (odp_buffer_t)(uintptr_t)dma_compl; if (odp_unlikely(dma_compl == ODP_DMA_COMPL_INVALID)) { - ODP_ERR("Bad DMA compl handle\n"); + _ODP_ERR("Bad DMA compl handle\n"); return; } @@ -810,7 +810,7 @@ int odp_dma_compl_result(odp_dma_compl_t dma_compl, odp_dma_result_t *result_out odp_buffer_t buf = (odp_buffer_t)(uintptr_t)dma_compl; if (odp_unlikely(dma_compl == ODP_DMA_COMPL_INVALID)) { - ODP_ERR("Bad DMA compl handle\n"); + _ODP_ERR("Bad DMA compl handle\n"); return -1; } @@ -837,15 +837,15 @@ void odp_dma_print(odp_dma_t dma) dma_session_t *session = dma_session_from_handle(dma); if (dma == ODP_DMA_INVALID) { - ODP_ERR("Bad DMA handle\n"); + _ODP_ERR("Bad DMA handle\n"); return; } - ODP_PRINT("\nDMA info\n"); - ODP_PRINT("--------\n"); - ODP_PRINT(" DMA handle 0x%" PRIx64 "\n", odp_dma_to_u64(dma)); - ODP_PRINT(" name %s\n", session->name); - ODP_PRINT("\n"); + _ODP_PRINT("\nDMA info\n"); + _ODP_PRINT("--------\n"); + _ODP_PRINT(" DMA handle 0x%" PRIx64 "\n", odp_dma_to_u64(dma)); + _ODP_PRINT(" name %s\n", session->name); + _ODP_PRINT("\n"); } void odp_dma_compl_print(odp_dma_compl_t dma_compl) @@ -854,25 +854,25 @@ void odp_dma_compl_print(odp_dma_compl_t dma_compl) int ret; if (dma_compl == ODP_DMA_COMPL_INVALID) { - ODP_ERR("Bad DMA compl handle\n"); + _ODP_ERR("Bad DMA compl handle\n"); return; } ret = odp_dma_compl_result(dma_compl, &result); - ODP_PRINT("\nDMA completion\n"); - ODP_PRINT("--------------\n"); - ODP_PRINT(" Compl event handle: 0x%" PRIx64 "\n", (uint64_t)(uintptr_t)dma_compl); + _ODP_PRINT("\nDMA completion\n"); + _ODP_PRINT("--------------\n"); + _ODP_PRINT(" Compl event handle: 0x%" PRIx64 "\n", (uint64_t)(uintptr_t)dma_compl); if (ret == 0) { - ODP_PRINT(" Result: %s\n", result.success ? "success" : "fail"); - ODP_PRINT(" User pointer: 0x%" PRIx64 "\n", - (uint64_t)(uintptr_t)result.user_ptr); + _ODP_PRINT(" Result: %s\n", result.success ? "success" : "fail"); + _ODP_PRINT(" User pointer: 0x%" PRIx64 "\n", + (uint64_t)(uintptr_t)result.user_ptr); } else { - ODP_PRINT(" No result metadata\n"); + _ODP_PRINT(" No result metadata\n"); } - ODP_PRINT("\n"); + _ODP_PRINT("\n"); } int _odp_dma_init_global(void) @@ -881,7 +881,7 @@ int _odp_dma_init_global(void) int i; if (odp_global_ro.disable.dma) { - ODP_PRINT("DMA is DISABLED\n"); + _ODP_PRINT("DMA is DISABLED\n"); return 0; } @@ -889,7 +889,7 @@ int _odp_dma_init_global(void) _odp_dma_glb = odp_shm_addr(shm); if (_odp_dma_glb == NULL) { - ODP_ERR("SHM reserve failed\n"); + _ODP_ERR("SHM reserve failed\n"); return -1; } @@ -899,7 +899,7 @@ int _odp_dma_init_global(void) odp_pool_param_init(&_odp_dma_glb->pool_param); if (odp_pool_capability(&_odp_dma_glb->pool_capa)) { - ODP_ERR("Pool capability failed\n"); + _ODP_ERR("Pool capability failed\n"); return -1; } @@ -922,7 +922,7 @@ int _odp_dma_term_global(void) shm = _odp_dma_glb->shm; if (odp_shm_free(shm)) { - ODP_ERR("SHM free failed\n"); + _ODP_ERR("SHM free failed\n"); return -1; } diff --git a/platform/linux-generic/odp_errno.c b/platform/linux-generic/odp_errno.c index 71fc2da77..bce398834 100644 --- a/platform/linux-generic/odp_errno.c +++ b/platform/linux-generic/odp_errno.c @@ -24,9 +24,9 @@ void odp_errno_zero(void) void odp_errno_print(const char *str) { if (str != NULL) - ODP_PRINT("%s %s\n", str, strerror(_odp_errno)); + _ODP_PRINT("%s %s\n", str, strerror(_odp_errno)); else - ODP_PRINT("%s\n", strerror(_odp_errno)); + _ODP_PRINT("%s\n", strerror(_odp_errno)); } const char *odp_errno_str(int errnum) diff --git a/platform/linux-generic/odp_event.c b/platform/linux-generic/odp_event.c index 5a1f68621..c4e0f2c9d 100644 --- a/platform/linux-generic/odp_event.c +++ b/platform/linux-generic/odp_event.c @@ -71,7 +71,7 @@ void odp_event_free(odp_event_t event) odp_dma_compl_free(odp_dma_compl_from_event(event)); break; default: - ODP_ABORT("Invalid event type: %d\n", odp_event_type(event)); + _ODP_ABORT("Invalid event type: %d\n", odp_event_type(event)); } } diff --git a/platform/linux-generic/odp_fdserver.c b/platform/linux-generic/odp_fdserver.c index 8bb12b64a..af9c1b498 100644 --- a/platform/linux-generic/odp_fdserver.c +++ b/platform/linux-generic/odp_fdserver.c @@ -157,7 +157,7 @@ static int send_fdserver_msg(int sock, int command, } res = sendmsg(sock, &socket_message, 0); if (res < 0) { - ODP_ERR("send_fdserver_msg: %s\n", strerror(errno)); + _ODP_ERR("sendmsg() failed: %s\n", strerror(errno)); return -1; } @@ -203,7 +203,7 @@ static int recv_fdserver_msg(int sock, int *command, /* receive the message */ if (recvmsg(sock, &socket_message, MSG_CMSG_CLOEXEC) < 0) { - ODP_ERR("recv_fdserver_msg: %s\n", strerror(errno)); + _ODP_ERR("recvmsg() failed: %s\n", strerror(errno)); return -1; } @@ -246,13 +246,13 @@ static int get_socket(void) odp_global_ro.main_pid); if (len >= FDSERVER_SOCKPATH_MAXLEN || len >= (int)sizeof(remote.sun_path)) { - ODP_ERR("path too long\n"); + _ODP_ERR("path too long\n"); return -1; } s_sock = socket(AF_UNIX, SOCK_STREAM, 0); if (s_sock == -1) { - ODP_ERR("cannot connect to server: %s\n", strerror(errno)); + _ODP_ERR("cannot connect to server: %s\n", strerror(errno)); return -1; } @@ -262,7 +262,7 @@ static int get_socket(void) while (connect(s_sock, (struct sockaddr *)&remote, len) == -1) { if (errno == EINTR) continue; - ODP_ERR("cannot connect to server: %s\n", strerror(errno)); + _ODP_ERR("cannot connect to server: %s\n", strerror(errno)); close(s_sock); return -1; } @@ -292,7 +292,7 @@ int _odp_fdserver_register_fd(fd_server_context_e context, uint64_t key, res = send_fdserver_msg(s_sock, FD_REGISTER_REQ, context, key, fd_to_send); if (res < 0) { - ODP_ERR("fd registration failure\n"); + _ODP_ERR("fd registration failure\n"); close(s_sock); return -1; } @@ -300,7 +300,7 @@ int _odp_fdserver_register_fd(fd_server_context_e context, uint64_t key, res = recv_fdserver_msg(s_sock, &command, &context, &key, &fd); if ((res < 0) || (command != FD_REGISTER_ACK)) { - ODP_ERR("fd registration failure\n"); + _ODP_ERR("fd registration failure\n"); close(s_sock); return -1; } @@ -330,7 +330,7 @@ int _odp_fdserver_deregister_fd(fd_server_context_e context, uint64_t key) res = send_fdserver_msg(s_sock, FD_DEREGISTER_REQ, context, key, -1); if (res < 0) { - ODP_ERR("fd de-registration failure\n"); + _ODP_ERR("fd de-registration failure\n"); close(s_sock); return -1; } @@ -338,7 +338,7 @@ int _odp_fdserver_deregister_fd(fd_server_context_e context, uint64_t key) res = recv_fdserver_msg(s_sock, &command, &context, &key, &fd); if ((res < 0) || (command != FD_DEREGISTER_ACK)) { - ODP_ERR("fd de-registration failure\n"); + _ODP_ERR("fd de-registration failure\n"); close(s_sock); return -1; } @@ -366,7 +366,7 @@ int _odp_fdserver_lookup_fd(fd_server_context_e context, uint64_t key) res = send_fdserver_msg(s_sock, FD_LOOKUP_REQ, context, key, -1); if (res < 0) { - ODP_ERR("fd lookup failure\n"); + _ODP_ERR("fd lookup failure\n"); close(s_sock); return -1; } @@ -374,14 +374,14 @@ int _odp_fdserver_lookup_fd(fd_server_context_e context, uint64_t key) res = recv_fdserver_msg(s_sock, &command, &context, &key, &fd); if ((res < 0) || (command != FD_LOOKUP_ACK)) { - ODP_ERR("fd lookup failure\n"); + _ODP_ERR("fd lookup failure\n"); close(s_sock); return -1; } close(s_sock); - ODP_DBG("FD client lookup: pid=%d, key=%" PRIu64 ", fd=%d\n", - getpid(), key, fd); + _ODP_DBG("FD client lookup: pid=%d, key=%" PRIu64 ", fd=%d\n", + getpid(), key, fd); return fd; } @@ -402,7 +402,7 @@ static int stop_server(void) res = send_fdserver_msg(s_sock, FD_SERVERSTOP_REQ, 0, 0, -1); if (res < 0) { - ODP_ERR("fd stop request failure\n"); + _ODP_ERR("fd stop request failure\n"); close(s_sock); return -1; } @@ -430,7 +430,7 @@ static int handle_request(int client_sock) switch (command) { case FD_REGISTER_REQ: if ((fd < 0) || (context >= FD_SRV_CTX_END)) { - ODP_ERR("Invalid register fd or context\n"); + _ODP_ERR("Invalid register fd or context\n"); send_fdserver_msg(client_sock, FD_REGISTER_NACK, FD_SRV_CTX_NA, 0, -1); return 0; @@ -444,7 +444,7 @@ static int handle_request(int client_sock) ODP_DBG_LVL(FD_DBG, "storing {ctx=%d, key=%" PRIu64 "}->fd=%d\n", context, key, fd); } else { - ODP_ERR("FD table full\n"); + _ODP_ERR("FD table full\n"); send_fdserver_msg(client_sock, FD_REGISTER_NACK, FD_SRV_CTX_NA, 0, -1); return 0; @@ -456,7 +456,7 @@ static int handle_request(int client_sock) case FD_LOOKUP_REQ: if (context >= FD_SRV_CTX_END) { - ODP_ERR("invalid lookup context\n"); + _ODP_ERR("invalid lookup context\n"); send_fdserver_msg(client_sock, FD_LOOKUP_NACK, FD_SRV_CTX_NA, 0, -1); return 0; @@ -467,7 +467,7 @@ static int handle_request(int client_sock) if ((fd_table[i].context == context) && (fd_table[i].key == key)) { fd = fd_table[i].fd; - ODP_DBG("lookup {ctx=%d," + _ODP_DBG("lookup {ctx=%d," " key=%" PRIu64 "}->fd=%d\n", context, key, fd); send_fdserver_msg(client_sock, @@ -484,7 +484,7 @@ static int handle_request(int client_sock) case FD_DEREGISTER_REQ: if (context >= FD_SRV_CTX_END) { - ODP_ERR("invalid deregister context\n"); + _ODP_ERR("invalid deregister context\n"); send_fdserver_msg(client_sock, FD_DEREGISTER_NACK, FD_SRV_CTX_NA, 0, -1); return 0; @@ -516,7 +516,7 @@ static int handle_request(int client_sock) return 1; default: - ODP_ERR("Unexpected request\n"); + _ODP_ERR("Unexpected request\n"); break; } return 0; @@ -539,7 +539,7 @@ static void wait_requests(int sock) if (errno == EINTR) continue; - ODP_ERR("wait_requests: %s\n", strerror(errno)); + _ODP_ERR("accept() failed: %s\n", strerror(errno)); return; } @@ -574,14 +574,14 @@ int _odp_fdserver_init_global(void) odp_global_ro.main_pid); if (len >= FDSERVER_SOCKPATH_MAXLEN || len >= (int)sizeof(local.sun_path)) { - ODP_ERR("path too long\n"); + _ODP_ERR("path too long\n"); return -1; } /* create UNIX domain socket: */ sock = socket(AF_UNIX, SOCK_STREAM, 0); if (sock == -1) { - ODP_ERR("_odp_fdserver_init_global: %s\n", strerror(errno)); + _ODP_ERR("socket() failed: %s\n", strerror(errno)); return -1; } @@ -595,14 +595,14 @@ int _odp_fdserver_init_global(void) res = bind(sock, (struct sockaddr *)&local, sizeof(struct sockaddr_un)); if (res == -1) { - ODP_ERR("_odp_fdserver_init_global: %s\n", strerror(errno)); + _ODP_ERR("bind() failed: %s\n", strerror(errno)); close(sock); return -1; } - /* listen for incoming conections: */ + /* listen for incoming connections: */ if (listen(sock, FDSERVER_BACKLOG) == -1) { - ODP_ERR("_odp_fdserver_init_global: %s\n", strerror(errno)); + _ODP_ERR("listen() failed: %s\n", strerror(errno)); close(sock); return -1; } @@ -610,7 +610,7 @@ int _odp_fdserver_init_global(void) /* fork a server process: */ server_pid = fork(); if (server_pid == -1) { - ODP_ERR("Could not fork!\n"); + _ODP_ERR("Could not fork!\n"); close(sock); return -1; } @@ -630,7 +630,7 @@ int _odp_fdserver_init_global(void) /* these we want to handle */ sigdelset(&sigset, SIGTERM); if (sigprocmask(SIG_SETMASK, &sigset, NULL) == -1) { - ODP_ERR("Could not set signal mask"); + _ODP_ERR("Could not set signal mask"); exit(1); } @@ -653,14 +653,14 @@ int _odp_fdserver_init_global(void) res = setsid(); if (res == -1) { - ODP_ERR("Could not setsid()"); + _ODP_ERR("Could not setsid()"); exit(1); } /* allocate the space for the file descriptor<->key table: */ fd_table = malloc(FDSERVER_MAX_ENTRIES * sizeof(fdentry_t)); if (!fd_table) { - ODP_ERR("maloc failed!\n"); + _ODP_ERR("maloc failed!\n"); exit(1); } @@ -691,15 +691,15 @@ int _odp_fdserver_term_global(void) /* close fdserver and wait for it to terminate */ if (stop_server()) { - ODP_ERR("Server stop failed\n"); + _ODP_ERR("Server stop failed\n"); return -1; } - ODP_DBG("Waiting for fdserver (%i) to stop\n", odp_global_ro.fdserver_pid); + _ODP_DBG("Waiting for fdserver (%i) to stop\n", odp_global_ro.fdserver_pid); pid = waitpid(odp_global_ro.fdserver_pid, &status, 0); if (pid != odp_global_ro.fdserver_pid) - ODP_ERR("Failed to wait for fdserver\n"); + _ODP_ERR("Failed to wait for fdserver\n"); /* construct the server named socket path: */ snprintf(sockpath, FDSERVER_SOCKPATH_MAXLEN, FDSERVER_SOCK_FORMAT, diff --git a/platform/linux-generic/odp_hash_crc_gen.c b/platform/linux-generic/odp_hash_crc_gen.c index 109d15420..f831c63b8 100644 --- a/platform/linux-generic/odp_hash_crc_gen.c +++ b/platform/linux-generic/odp_hash_crc_gen.c @@ -39,7 +39,7 @@ int _odp_hash_init_global(void) crc_table = odp_shm_addr(shm); if (crc_table == NULL) { - ODP_ERR("Shm reserve failed for odp_hash_crc_gen\n"); + _ODP_ERR("Shm reserve failed for odp_hash_crc_gen\n"); return -1; } @@ -54,7 +54,7 @@ int _odp_hash_init_global(void) int _odp_hash_term_global(void) { if (odp_shm_free(crc_table->shm)) { - ODP_ERR("Shm free failed for odp_hash_crc_gen\n"); + _ODP_ERR("Shm free failed for odp_hash_crc_gen\n"); return -1; } @@ -203,18 +203,18 @@ int odp_hash_crc_gen64(const void *data_ptr, uint32_t data_len, int reflect = crc_param->reflect_in; if (odp_unlikely(crc_param->reflect_in != crc_param->reflect_out)) { - ODP_ERR("Odd reflection setting not supported.\n"); + _ODP_ERR("Odd reflection setting not supported.\n"); return -1; } if (odp_unlikely(width != 32 && width != 24 && width != 16)) { - ODP_ERR("CRC width %" PRIu32 " bits not supported.\n", width); + _ODP_ERR("CRC width %" PRIu32 " bits not supported.\n", width); return -1; } /* TODO: fix implementation of 24 bit CRC with reflection */ if (odp_unlikely(width == 24 && reflect)) { - ODP_ERR("24 bit CRC with reflection not supported.\n"); + _ODP_ERR("24 bit CRC with reflection not supported.\n"); return -1; } diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c index 1f4ecc6ee..284b3e566 100644 --- a/platform/linux-generic/odp_init.c +++ b/platform/linux-generic/odp_init.c @@ -111,7 +111,7 @@ static int global_rw_data_init(void) odp_global_rw = odp_shm_addr(shm); if (odp_global_rw == NULL) { - ODP_ERR("Global RW data shm reserve failed.\n"); + _ODP_ERR("Global RW data shm reserve failed.\n"); return -1; } @@ -126,12 +126,12 @@ static int global_rw_data_term(void) shm = odp_shm_lookup("_odp_global_rw_data"); if (shm == ODP_SHM_INVALID) { - ODP_ERR("Unable to find global RW data shm.\n"); + _ODP_ERR("Unable to find global RW data shm.\n"); return -1; } if (odp_shm_free(shm)) { - ODP_ERR("Global RW data shm free failed.\n"); + _ODP_ERR("Global RW data shm free failed.\n"); return -1; } @@ -146,154 +146,154 @@ static int term_global(enum init_stage stage) case ALL_INIT: case DMA_INIT: if (_odp_dma_term_global()) { - ODP_ERR("ODP DMA term failed.\n"); + _ODP_ERR("ODP DMA term failed.\n"); rc = -1; } /* Fall through */ case IPSEC_INIT: if (_odp_ipsec_term_global()) { - ODP_ERR("ODP IPsec term failed.\n"); + _ODP_ERR("ODP IPsec term failed.\n"); rc = -1; } /* Fall through */ case IPSEC_SAD_INIT: if (_odp_ipsec_sad_term_global()) { - ODP_ERR("ODP IPsec SAD term failed.\n"); + _ODP_ERR("ODP IPsec SAD term failed.\n"); rc = -1; } /* Fall through */ case IPSEC_EVENTS_INIT: if (_odp_ipsec_events_term_global()) { - ODP_ERR("ODP IPsec events term failed.\n"); + _ODP_ERR("ODP IPsec events term failed.\n"); rc = -1; } /* Fall through */ case NAME_TABLE_INIT: if (_odp_int_name_tbl_term_global()) { - ODP_ERR("Name table term failed.\n"); + _ODP_ERR("Name table term failed.\n"); rc = -1; } /* Fall through */ case TRAFFIC_MNGR_INIT: if (_odp_tm_term_global()) { - ODP_ERR("TM term failed.\n"); + _ODP_ERR("TM term failed.\n"); rc = -1; } /* Fall through */ case CLASSIFICATION_INIT: if (_odp_classification_term_global()) { - ODP_ERR("ODP classification term failed.\n"); + _ODP_ERR("ODP classification term failed.\n"); rc = -1; } /* Fall through */ case COMP_INIT: if (_odp_comp_term_global()) { - ODP_ERR("ODP comp term failed.\n"); + _ODP_ERR("ODP comp term failed.\n"); rc = -1; } /* Fall through */ case CRYPTO_INIT: if (_odp_crypto_term_global()) { - ODP_ERR("ODP crypto term failed.\n"); + _ODP_ERR("ODP crypto term failed.\n"); rc = -1; } /* Fall through */ case TIMER_INIT: if (_odp_timer_term_global()) { - ODP_ERR("ODP timer term failed.\n"); + _ODP_ERR("ODP timer term failed.\n"); rc = -1; } /* Fall through */ case PKTIO_INIT: if (_odp_pktio_term_global()) { - ODP_ERR("ODP pktio term failed.\n"); + _ODP_ERR("ODP pktio term failed.\n"); rc = -1; } /* Fall through */ case SCHED_INIT: if (_odp_schedule_term_global()) { - ODP_ERR("ODP schedule term failed.\n"); + _ODP_ERR("ODP schedule term failed.\n"); rc = -1; } /* Fall through */ case QUEUE_INIT: if (_odp_queue_term_global()) { - ODP_ERR("ODP queue term failed.\n"); + _ODP_ERR("ODP queue term failed.\n"); rc = -1; } /* Fall through */ case STASH_INIT: if (_odp_stash_term_global()) { - ODP_ERR("ODP stash term failed.\n"); + _ODP_ERR("ODP stash term failed.\n"); rc = -1; } /* Fall through */ case POOL_INIT: if (_odp_pool_term_global()) { - ODP_ERR("ODP buffer pool term failed.\n"); + _ODP_ERR("ODP buffer pool term failed.\n"); rc = -1; } /* Fall through */ case THREAD_INIT: if (_odp_thread_term_global()) { - ODP_ERR("ODP thread term failed.\n"); + _ODP_ERR("ODP thread term failed.\n"); rc = -1; } /* Fall through */ case HASH_INIT: if (_odp_hash_term_global()) { - ODP_ERR("ODP hash term failed.\n"); + _ODP_ERR("ODP hash term failed.\n"); rc = -1; } /* Fall through */ case GLOBAL_RW_DATA_INIT: if (global_rw_data_term()) { - ODP_ERR("ODP global RW data term failed.\n"); + _ODP_ERR("ODP global RW data term failed.\n"); rc = -1; } /* Fall through */ case FDSERVER_INIT: if (_odp_fdserver_term_global()) { - ODP_ERR("ODP fdserver term failed.\n"); + _ODP_ERR("ODP fdserver term failed.\n"); rc = -1; } /* Fall through */ case ISHM_INIT: if (_odp_ishm_term_global()) { - ODP_ERR("ODP ishm term failed.\n"); + _ODP_ERR("ODP ishm term failed.\n"); rc = -1; } /* Fall through */ case SYSINFO_INIT: if (_odp_system_info_term()) { - ODP_ERR("ODP system info term failed.\n"); + _ODP_ERR("ODP system info term failed.\n"); rc = -1; } /* Fall through */ case TIME_INIT: if (_odp_time_term_global()) { - ODP_ERR("ODP time term failed.\n"); + _ODP_ERR("ODP time term failed.\n"); rc = -1; } /* Fall through */ @@ -302,14 +302,14 @@ static int term_global(enum init_stage stage) /* Fall through */ case CPUMASK_INIT: if (_odp_cpumask_term_global()) { - ODP_ERR("ODP cpumask term failed.\n"); + _ODP_ERR("ODP cpumask term failed.\n"); rc = -1; } /* Fall through */ case LIBCONFIG_INIT: if (_odp_libconfig_term_global()) { - ODP_ERR("ODP runtime config term failed.\n"); + _ODP_ERR("ODP runtime config term failed.\n"); rc = -1; } /* Fall through */ @@ -345,7 +345,7 @@ int odp_init_global(odp_instance_t *instance, } if (_odp_libconfig_init_global()) { - ODP_ERR("ODP runtime config init failed.\n"); + _ODP_ERR("ODP runtime config init failed.\n"); goto init_failed; } stage = LIBCONFIG_INIT; @@ -353,145 +353,145 @@ int odp_init_global(odp_instance_t *instance, disable_features(&odp_global_ro, params); if (_odp_cpumask_init_global(params)) { - ODP_ERR("ODP cpumask init failed.\n"); + _ODP_ERR("ODP cpumask init failed.\n"); goto init_failed; } stage = CPUMASK_INIT; if (_odp_cpu_cycles_init_global()) { - ODP_ERR("ODP cpu cycle init failed.\n"); + _ODP_ERR("ODP cpu cycle init failed.\n"); goto init_failed; } stage = CPU_CYCLES_INIT; if (_odp_time_init_global()) { - ODP_ERR("ODP time init failed.\n"); + _ODP_ERR("ODP time init failed.\n"); goto init_failed; } stage = TIME_INIT; if (_odp_system_info_init()) { - ODP_ERR("ODP system_info init failed.\n"); + _ODP_ERR("ODP system_info init failed.\n"); goto init_failed; } stage = SYSINFO_INIT; if (_odp_ishm_init_global(params)) { - ODP_ERR("ODP ishm init failed.\n"); + _ODP_ERR("ODP ishm init failed.\n"); goto init_failed; } stage = ISHM_INIT; if (_odp_fdserver_init_global()) { - ODP_ERR("ODP fdserver init failed.\n"); + _ODP_ERR("ODP fdserver init failed.\n"); goto init_failed; } stage = FDSERVER_INIT; if (global_rw_data_init()) { - ODP_ERR("ODP global RW data init failed.\n"); + _ODP_ERR("ODP global RW data init failed.\n"); goto init_failed; } stage = GLOBAL_RW_DATA_INIT; if (_odp_hash_init_global()) { - ODP_ERR("ODP hash init failed.\n"); + _ODP_ERR("ODP hash init failed.\n"); goto init_failed; } stage = HASH_INIT; if (_odp_thread_init_global()) { - ODP_ERR("ODP thread init failed.\n"); + _ODP_ERR("ODP thread init failed.\n"); goto init_failed; } stage = THREAD_INIT; if (_odp_pool_init_global()) { - ODP_ERR("ODP pool init failed.\n"); + _ODP_ERR("ODP pool init failed.\n"); goto init_failed; } stage = POOL_INIT; if (_odp_stash_init_global()) { - ODP_ERR("ODP stash init failed.\n"); + _ODP_ERR("ODP stash init failed.\n"); goto init_failed; } stage = STASH_INIT; if (_odp_queue_init_global()) { - ODP_ERR("ODP queue init failed.\n"); + _ODP_ERR("ODP queue init failed.\n"); goto init_failed; } stage = QUEUE_INIT; if (_odp_schedule_init_global()) { - ODP_ERR("ODP schedule init failed.\n"); + _ODP_ERR("ODP schedule init failed.\n"); goto init_failed; } stage = SCHED_INIT; if (_odp_pktio_init_global()) { - ODP_ERR("ODP packet io init failed.\n"); + _ODP_ERR("ODP packet io init failed.\n"); goto init_failed; } stage = PKTIO_INIT; if (_odp_timer_init_global(params)) { - ODP_ERR("ODP timer init failed.\n"); + _ODP_ERR("ODP timer init failed.\n"); goto init_failed; } stage = TIMER_INIT; if (_odp_crypto_init_global()) { - ODP_ERR("ODP crypto init failed.\n"); + _ODP_ERR("ODP crypto init failed.\n"); goto init_failed; } stage = CRYPTO_INIT; if (_odp_comp_init_global()) { - ODP_ERR("ODP comp init failed.\n"); + _ODP_ERR("ODP comp init failed.\n"); goto init_failed; } stage = COMP_INIT; if (_odp_classification_init_global()) { - ODP_ERR("ODP classification init failed.\n"); + _ODP_ERR("ODP classification init failed.\n"); goto init_failed; } stage = CLASSIFICATION_INIT; if (_odp_tm_init_global()) { - ODP_ERR("ODP traffic manager init failed\n"); + _ODP_ERR("ODP traffic manager init failed\n"); goto init_failed; } stage = TRAFFIC_MNGR_INIT; if (_odp_int_name_tbl_init_global()) { - ODP_ERR("ODP name table init failed\n"); + _ODP_ERR("ODP name table init failed\n"); goto init_failed; } stage = NAME_TABLE_INIT; if (_odp_ipsec_events_init_global()) { - ODP_ERR("ODP IPsec events init failed.\n"); + _ODP_ERR("ODP IPsec events init failed.\n"); goto init_failed; } stage = IPSEC_EVENTS_INIT; if (_odp_ipsec_sad_init_global()) { - ODP_ERR("ODP IPsec SAD init failed.\n"); + _ODP_ERR("ODP IPsec SAD init failed.\n"); goto init_failed; } stage = IPSEC_SAD_INIT; if (_odp_ipsec_init_global()) { - ODP_ERR("ODP IPsec init failed.\n"); + _ODP_ERR("ODP IPsec init failed.\n"); goto init_failed; } stage = IPSEC_INIT; if (_odp_dma_init_global()) { - ODP_ERR("ODP DMA init failed.\n"); + _ODP_ERR("ODP DMA init failed.\n"); goto init_failed; } stage = DMA_INIT; @@ -508,7 +508,7 @@ init_failed: int odp_term_global(odp_instance_t instance) { if (instance != (odp_instance_t)odp_global_ro.main_pid) { - ODP_ERR("Bad instance.\n"); + _ODP_ERR("Bad instance.\n"); return -1; } return term_global(ALL_INIT); @@ -524,42 +524,42 @@ static int term_local(enum init_stage stage) case SCHED_INIT: if (_odp_sched_fn->term_local()) { - ODP_ERR("ODP schedule local term failed.\n"); + _ODP_ERR("ODP schedule local term failed.\n"); rc = -1; } /* Fall through */ case QUEUE_INIT: if (_odp_queue_fn->term_local()) { - ODP_ERR("ODP queue local term failed.\n"); + _ODP_ERR("ODP queue local term failed.\n"); rc = -1; } /* Fall through */ case POOL_INIT: if (_odp_pool_term_local()) { - ODP_ERR("ODP buffer pool local term failed.\n"); + _ODP_ERR("ODP buffer pool local term failed.\n"); rc = -1; } /* Fall through */ case CRYPTO_INIT: if (_odp_crypto_term_local()) { - ODP_ERR("ODP crypto local term failed.\n"); + _ODP_ERR("ODP crypto local term failed.\n"); rc = -1; } /* Fall through */ case RANDOM_INIT: if (_odp_random_term_local()) { - ODP_ERR("ODP random local term failed.\n"); + _ODP_ERR("ODP random local term failed.\n"); rc = -1; } /* Fall through */ case TIMER_INIT: if (_odp_timer_term_local()) { - ODP_ERR("ODP timer local term failed.\n"); + _ODP_ERR("ODP timer local term failed.\n"); rc = -1; } /* Fall through */ @@ -567,7 +567,7 @@ static int term_local(enum init_stage stage) case THREAD_INIT: rc_thd = _odp_thread_term_local(); if (rc_thd < 0) { - ODP_ERR("ODP thread local term failed.\n"); + _ODP_ERR("ODP thread local term failed.\n"); rc = -1; } else { if (!rc) @@ -577,7 +577,7 @@ static int term_local(enum init_stage stage) case ISHM_INIT: if (_odp_ishm_term_local()) { - ODP_ERR("ODP ishm local term failed.\n"); + _ODP_ERR("ODP ishm local term failed.\n"); rc = -1; } /* Fall through */ @@ -594,67 +594,67 @@ int odp_init_local(odp_instance_t instance, odp_thread_type_t thr_type) enum init_stage stage = NO_INIT; if (instance != (odp_instance_t)odp_global_ro.main_pid) { - ODP_ERR("Bad instance.\n"); + _ODP_ERR("Bad instance.\n"); goto init_fail; } /* Detect if odp_init_local() has been already called from this thread */ if (getpid() == odp_global_ro.main_pid && init_local_called) { - ODP_ERR("%s() called multiple times by the same thread\n", __func__); + _ODP_ERR("%s() called multiple times by the same thread\n", __func__); goto init_fail; } init_local_called = 1; if (_odp_ishm_init_local()) { - ODP_ERR("ODP ishm local init failed.\n"); + _ODP_ERR("ODP ishm local init failed.\n"); goto init_fail; } stage = ISHM_INIT; if (_odp_thread_init_local(thr_type)) { - ODP_ERR("ODP thread local init failed.\n"); + _ODP_ERR("ODP thread local init failed.\n"); goto init_fail; } stage = THREAD_INIT; if (_odp_pktio_init_local()) { - ODP_ERR("ODP packet io local init failed.\n"); + _ODP_ERR("ODP packet io local init failed.\n"); goto init_fail; } stage = PKTIO_INIT; if (_odp_timer_init_local()) { - ODP_ERR("ODP timer local init failed.\n"); + _ODP_ERR("ODP timer local init failed.\n"); goto init_fail; } stage = TIMER_INIT; if (_odp_random_init_local()) { - ODP_ERR("ODP random local init failed.\n"); + _ODP_ERR("ODP random local init failed.\n"); goto init_fail; } stage = RANDOM_INIT; if (_odp_crypto_init_local()) { - ODP_ERR("ODP crypto local init failed.\n"); + _ODP_ERR("ODP crypto local init failed.\n"); goto init_fail; } stage = CRYPTO_INIT; if (_odp_pool_init_local()) { - ODP_ERR("ODP pool local init failed.\n"); + _ODP_ERR("ODP pool local init failed.\n"); goto init_fail; } stage = POOL_INIT; if (_odp_queue_fn->init_local()) { - ODP_ERR("ODP queue local init failed.\n"); + _ODP_ERR("ODP queue local init failed.\n"); goto init_fail; } stage = QUEUE_INIT; if (_odp_sched_fn->init_local()) { - ODP_ERR("ODP schedule local init failed.\n"); + _ODP_ERR("ODP schedule local init failed.\n"); goto init_fail; } /* stage = SCHED_INIT; */ @@ -670,7 +670,7 @@ int odp_term_local(void) { /* Check that odp_init_local() has been called by this thread */ if (!init_local_called) { - ODP_ERR("%s() called by a non-initialized thread\n", __func__); + _ODP_ERR("%s() called by a non-initialized thread\n", __func__); return -1; } init_local_called = 0; diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index 98fd2ac53..b269e232c 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -146,7 +146,7 @@ int odp_ipsec_capability(odp_ipsec_capability_t *capa) odp_queue_capability_t queue_capa; if (odp_global_ro.disable.ipsec) { - ODP_ERR("IPSec is disabled\n"); + _ODP_ERR("IPSec is disabled\n"); return -1; } @@ -315,7 +315,7 @@ odp_bool_t _odp_ipsec_is_sync_mode(odp_ipsec_dir_t dir) static odp_ipsec_packet_result_t *ipsec_pkt_result(odp_packet_t packet) { - ODP_ASSERT(ODP_EVENT_PACKET_IPSEC == + _ODP_ASSERT(ODP_EVENT_PACKET_IPSEC == odp_event_subtype(odp_packet_to_event(packet))); return &packet_hdr(packet)->ipsec_ctx; @@ -517,7 +517,7 @@ static inline ipsec_sa_t *ipsec_get_sa(odp_ipsec_sa_t sa, } } else { ipsec_sa = _odp_ipsec_sa_entry_from_hdl(sa); - ODP_ASSERT(NULL != ipsec_sa); + _ODP_ASSERT(NULL != ipsec_sa); if (ipsec_sa->proto != proto || ipsec_sa->spi != spi) { status->error.proto = 1; @@ -646,7 +646,7 @@ static int ipsec_in_esp(odp_packet_t *pkt, if (odp_packet_extend_tail(pkt, IPSEC_SEQ_HI_LEN, NULL, NULL) < 0) { status->error.alg = 1; - ODP_ERR("odp_packet_extend_tail failed\n"); + _ODP_ERR("odp_packet_extend_tail failed\n"); return -1; } odp_packet_move_data(*pkt, icv_offset + IPSEC_SEQ_HI_LEN, icv_offset, @@ -775,7 +775,7 @@ static int ipsec_in_ah(odp_packet_t *pkt, if (odp_packet_extend_tail(pkt, IPSEC_SEQ_HI_LEN, NULL, NULL) < 0) { status->error.alg = 1; - ODP_ERR("odp_packet_extend_tail failed\n"); + _ODP_ERR("odp_packet_extend_tail failed\n"); return -1; } odp_packet_copy_from_mem(*pkt, seqh_offset, IPSEC_SEQ_HI_LEN, &inb_seqh); @@ -874,10 +874,10 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt, odp_crypto_packet_result_t crypto; /**< Crypto operation result */ state.ip_offset = odp_packet_l3_offset(pkt); - ODP_ASSERT(ODP_PACKET_OFFSET_INVALID != state.ip_offset); + _ODP_ASSERT(ODP_PACKET_OFFSET_INVALID != state.ip_offset); state.ip = odp_packet_l3_ptr(pkt, NULL); - ODP_ASSERT(NULL != state.ip); + _ODP_ASSERT(NULL != state.ip); /* Initialize parameters block */ memset(¶m, 0, sizeof(param)); @@ -928,14 +928,14 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt, rc = odp_crypto_op(&pkt, &pkt, ¶m, 1); if (rc < 0) { - ODP_DBG("Crypto failed\n"); + _ODP_DBG("Crypto failed\n"); status->error.alg = 1; goto exit; } rc = odp_crypto_result(&crypto, pkt); if (rc < 0) { - ODP_DBG("Crypto failed\n"); + _ODP_DBG("Crypto failed\n"); status->error.alg = 1; goto exit; } @@ -1101,7 +1101,7 @@ uint64_t ipsec_seq_no(ipsec_sa_t *ipsec_sa) */ static inline uint32_t ipsec_padded_len(uint32_t len, uint32_t pad_mask) { - ODP_ASSERT(_ODP_CHECK_IS_POWER2(pad_mask + 1)); + _ODP_ASSERT(_ODP_CHECK_IS_POWER2(pad_mask + 1)); return (len + pad_mask) & ~pad_mask; } @@ -1295,7 +1295,7 @@ static int ipsec_out_iv(ipsec_state_t *state, { if (ipsec_sa->use_counter_iv) { /* Both GCM and CTR use 8-bit counters */ - ODP_ASSERT(sizeof(seq_no) == ipsec_sa->esp_iv_len); + _ODP_ASSERT(sizeof(seq_no) == ipsec_sa->esp_iv_len); /* Check for overrun */ if (seq_no == 0) @@ -1475,7 +1475,7 @@ static int ipsec_out_esp(odp_packet_t *pkt, if (odp_packet_extend_tail(pkt, IPSEC_SEQ_HI_LEN, NULL, NULL) < 0) { status->error.alg = 1; - ODP_ERR("odp_packet_extend_tail failed\n"); + _ODP_ERR("odp_packet_extend_tail failed\n"); return -1; } odp_packet_copy_from_mem(*pkt, @@ -1525,7 +1525,7 @@ static int ipsec_out_esp_post(ipsec_state_t *state, odp_packet_t *pkt, odp_packet_move_data(*pkt, icv_offset - IPSEC_SEQ_HI_LEN, icv_offset, ipsec_sa->icv_len); if (odp_packet_trunc_tail(pkt, IPSEC_SEQ_HI_LEN, NULL, NULL) < 0) { - ODP_ERR("odp_packet_trunc_tail failed\n"); + _ODP_ERR("odp_packet_trunc_tail failed\n"); return -1; } } @@ -1631,7 +1631,7 @@ static int ipsec_out_ah(odp_packet_t *pkt, if (odp_packet_extend_tail(pkt, IPSEC_SEQ_HI_LEN, NULL, NULL) < 0) { status->error.alg = 1; - ODP_ERR("odp_packet_extend_tail failed\n"); + _ODP_ERR("odp_packet_extend_tail failed\n"); return -1; } odp_packet_copy_from_mem(*pkt, @@ -1672,7 +1672,7 @@ static int ipsec_out_ah_post(ipsec_state_t *state, odp_packet_t *pkt, */ if (ipsec_sa->insert_seq_hi) { if (odp_packet_trunc_tail(pkt, IPSEC_SEQ_HI_LEN, NULL, NULL) < 0) { - ODP_ERR("odp_packet_trunc_tail failed\n"); + _ODP_ERR("odp_packet_trunc_tail failed\n"); return -1; } } @@ -1748,12 +1748,12 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt, * is done by the application. */ ipsec_sa = _odp_ipsec_sa_entry_from_hdl(sa); - ODP_ASSERT(NULL != ipsec_sa); + _ODP_ASSERT(NULL != ipsec_sa); if (opt->flag.tfc_dummy) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - ODP_ASSERT(ODP_IPSEC_MODE_TUNNEL == ipsec_sa->mode); + _ODP_ASSERT(ODP_IPSEC_MODE_TUNNEL == ipsec_sa->mode); pkt_hdr->p.l2_offset = ODP_PACKET_OFFSET_INVALID; pkt_hdr->p.l3_offset = 0; state.ip_offset = 0; @@ -1762,10 +1762,10 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt, state.is_ipv6 = 0; } else { state.ip_offset = odp_packet_l3_offset(pkt); - ODP_ASSERT(ODP_PACKET_OFFSET_INVALID != state.ip_offset); + _ODP_ASSERT(ODP_PACKET_OFFSET_INVALID != state.ip_offset); state.ip = odp_packet_l3_ptr(pkt, NULL); - ODP_ASSERT(NULL != state.ip); + _ODP_ASSERT(NULL != state.ip); state.is_ipv4 = (((uint8_t *)state.ip)[0] >> 4) == 0x4; state.is_ipv6 = (((uint8_t *)state.ip)[0] >> 4) == 0x6; @@ -1869,14 +1869,14 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt, */ rc = odp_crypto_op(&pkt, &pkt, ¶m, 1); if (rc < 0) { - ODP_DBG("Crypto failed\n"); + _ODP_DBG("Crypto failed\n"); status->error.alg = 1; goto post_lifetime_err_cnt_update; } rc = odp_crypto_result(&crypto, pkt); if (rc < 0) { - ODP_DBG("Crypto failed\n"); + _ODP_DBG("Crypto failed\n"); status->error.alg = 1; goto post_lifetime_err_cnt_update; } @@ -1935,7 +1935,7 @@ int odp_ipsec_in(const odp_packet_t pkt_in[], int num_in, sa = ODP_IPSEC_SA_INVALID; } else { sa = param->sa[sa_idx]; - ODP_ASSERT(ODP_IPSEC_SA_INVALID != sa); + _ODP_ASSERT(ODP_IPSEC_SA_INVALID != sa); } ipsec_sa = ipsec_in_single(pkt, sa, &pkt, false, &status, &dummy); @@ -1982,7 +1982,7 @@ int odp_ipsec_out(const odp_packet_t pkt_in[], int num_in, unsigned sa_inc = (param->num_sa > 1) ? 1 : 0; unsigned opt_inc = (param->num_opt > 1) ? 1 : 0; - ODP_ASSERT(param->num_sa != 0); + _ODP_ASSERT(param->num_sa != 0); while (in_pkt < num_in && out_pkt < max_out) { odp_packet_t pkt = pkt_in[in_pkt]; @@ -1995,7 +1995,7 @@ int odp_ipsec_out(const odp_packet_t pkt_in[], int num_in, memset(&status, 0, sizeof(status)); sa = param->sa[sa_idx]; - ODP_ASSERT(ODP_IPSEC_SA_INVALID != sa); + _ODP_ASSERT(ODP_IPSEC_SA_INVALID != sa); if (0 == param->num_opt) opt = &default_out_opt; @@ -2003,7 +2003,7 @@ int odp_ipsec_out(const odp_packet_t pkt_in[], int num_in, opt = ¶m->opt[opt_idx]; ipsec_sa = ipsec_out_single(pkt, sa, &pkt, opt, false, &status); - ODP_ASSERT(NULL != ipsec_sa); + _ODP_ASSERT(NULL != ipsec_sa); packet_subtype_set(pkt, ODP_EVENT_PACKET_IPSEC); result = ipsec_pkt_result(pkt); @@ -2049,7 +2049,7 @@ int odp_ipsec_in_enq(const odp_packet_t pkt_in[], int num_in, sa = ODP_IPSEC_SA_INVALID; } else { sa = param->sa[sa_idx]; - ODP_ASSERT(ODP_IPSEC_SA_INVALID != sa); + _ODP_ASSERT(ODP_IPSEC_SA_INVALID != sa); } ipsec_sa = ipsec_in_single(pkt, sa, &pkt, true, &status, &orig_ip_len); @@ -2097,7 +2097,7 @@ int odp_ipsec_out_enq(const odp_packet_t pkt_in[], int num_in, unsigned sa_inc = (param->num_sa > 1) ? 1 : 0; unsigned opt_inc = (param->num_opt > 1) ? 1 : 0; - ODP_ASSERT(param->num_sa != 0); + _ODP_ASSERT(param->num_sa != 0); while (in_pkt < num_in) { odp_packet_t pkt = pkt_in[in_pkt]; @@ -2112,7 +2112,7 @@ int odp_ipsec_out_enq(const odp_packet_t pkt_in[], int num_in, memset(&status, 0, sizeof(status)); sa = param->sa[sa_idx]; - ODP_ASSERT(ODP_IPSEC_SA_INVALID != sa); + _ODP_ASSERT(ODP_IPSEC_SA_INVALID != sa); if (0 == param->num_opt) opt = &default_out_opt; @@ -2120,7 +2120,7 @@ int odp_ipsec_out_enq(const odp_packet_t pkt_in[], int num_in, opt = ¶m->opt[opt_idx]; ipsec_sa = ipsec_out_single(pkt, sa, &pkt, opt, true, &status); - ODP_ASSERT(NULL != ipsec_sa); + _ODP_ASSERT(NULL != ipsec_sa); packet_subtype_set(pkt, ODP_EVENT_PACKET_IPSEC); result = ipsec_pkt_result(pkt); @@ -2201,7 +2201,7 @@ int odp_ipsec_out_inline(const odp_packet_t pkt_in[], int num_in, unsigned opt_inc = (param->num_opt > 1) ? 1 : 0; uint8_t hdr_buf[MAX_HDR_LEN]; - ODP_ASSERT(param->num_sa != 0); + _ODP_ASSERT(param->num_sa != 0); while (in_pkt < num_in) { odp_packet_t pkt = pkt_in[in_pkt]; @@ -2213,7 +2213,7 @@ int odp_ipsec_out_inline(const odp_packet_t pkt_in[], int num_in, uint32_t hdr_len, offset; const void *ptr; - ODP_ASSERT(inline_param[in_pkt].pktio != ODP_PKTIO_INVALID); + _ODP_ASSERT(inline_param[in_pkt].pktio != ODP_PKTIO_INVALID); memset(&status, 0, sizeof(status)); @@ -2221,7 +2221,7 @@ int odp_ipsec_out_inline(const odp_packet_t pkt_in[], int num_in, sa = ODP_IPSEC_SA_INVALID; } else { sa = param->sa[sa_idx]; - ODP_ASSERT(ODP_IPSEC_SA_INVALID != sa); + _ODP_ASSERT(ODP_IPSEC_SA_INVALID != sa); } hdr_len = inline_param[in_pkt].outer_hdr.len; @@ -2230,7 +2230,7 @@ int odp_ipsec_out_inline(const odp_packet_t pkt_in[], int num_in, if (!ptr) { uint32_t l2_offset = odp_packet_l2_offset(pkt); - ODP_ASSERT(hdr_len == odp_packet_l3_offset(pkt) - l2_offset); + _ODP_ASSERT(hdr_len == odp_packet_l3_offset(pkt) - l2_offset); if (odp_likely(hdr_len <= MAX_HDR_LEN) && odp_likely(odp_packet_copy_to_mem(pkt, l2_offset, @@ -2249,7 +2249,7 @@ int odp_ipsec_out_inline(const odp_packet_t pkt_in[], int num_in, opt = ¶m->opt[opt_idx]; ipsec_sa = ipsec_out_single(pkt, sa, &pkt, opt, true, &status); - ODP_ASSERT(NULL != ipsec_sa); + _ODP_ASSERT(NULL != ipsec_sa); offset = odp_packet_l3_offset(pkt); if (odp_unlikely(offset == ODP_PACKET_OFFSET_INVALID)) @@ -2321,7 +2321,7 @@ int odp_ipsec_test_sa_update(odp_ipsec_sa_t sa, ipsec_sa_t *ipsec_sa; ipsec_sa = _odp_ipsec_sa_entry_from_hdl(sa); - ODP_ASSERT(NULL != ipsec_sa); + _ODP_ASSERT(NULL != ipsec_sa); switch (sa_op) { case ODP_IPSEC_TEST_SA_UPDATE_SEQ_NUM: @@ -2338,7 +2338,7 @@ int odp_ipsec_result(odp_ipsec_packet_result_t *result, odp_packet_t packet) { odp_ipsec_packet_result_t *res; - ODP_ASSERT(result != NULL); + _ODP_ASSERT(result != NULL); res = ipsec_pkt_result(packet); @@ -2352,8 +2352,8 @@ int odp_ipsec_result(odp_ipsec_packet_result_t *result, odp_packet_t packet) odp_packet_t odp_ipsec_packet_from_event(odp_event_t ev) { - ODP_ASSERT(odp_event_type(ev) == ODP_EVENT_PACKET); - ODP_ASSERT(odp_event_subtype(ev) == ODP_EVENT_PACKET_IPSEC); + _ODP_ASSERT(odp_event_type(ev) == ODP_EVENT_PACKET); + _ODP_ASSERT(odp_event_subtype(ev) == ODP_EVENT_PACKET_IPSEC); return odp_packet_from_event(ev); } @@ -2372,10 +2372,10 @@ int odp_ipsec_stats(odp_ipsec_sa_t sa, odp_ipsec_stats_t *stats) if (!ipsec_config->stats_en) return -ENOTSUP; - ODP_ASSERT(NULL != stats); + _ODP_ASSERT(NULL != stats); ipsec_sa = _odp_ipsec_sa_entry_from_hdl(sa); - ODP_ASSERT(NULL != ipsec_sa); + _ODP_ASSERT(NULL != ipsec_sa); _odp_ipsec_sa_stats_pkts(ipsec_sa, stats); stats->proto_err = odp_atomic_load_u64(&ipsec_sa->stats.proto_err); @@ -2393,7 +2393,7 @@ int odp_ipsec_stats_multi(odp_ipsec_sa_t sa[], odp_ipsec_stats_t stats[], int nu { int ret, i; - ODP_ASSERT(NULL != stats); + _ODP_ASSERT(NULL != stats); for (i = 0; i < num; i++) { ret = odp_ipsec_stats(sa[i], &stats[i]); @@ -2411,13 +2411,13 @@ static int read_config_file(ipsec_global_t *global) int val; if (!_odp_libconfig_lookup_int(str_i, &val)) { - ODP_ERR("Config option '%s' not found.\n", str_i); + _ODP_ERR("Config option '%s' not found.\n", str_i); return -1; } global->inbound_ordering_mode = val; if (!_odp_libconfig_lookup_int(str_o, &val)) { - ODP_ERR("Config option '%s' not found.\n", str_o); + _ODP_ERR("Config option '%s' not found.\n", str_o); return -1; } global->outbound_ordering_mode = val; @@ -2435,12 +2435,12 @@ int _odp_ipsec_init_global(void) shm = odp_shm_reserve("_odp_ipsec_global", sizeof(*ipsec_global), ODP_CACHE_LINE_SIZE, 0); if (shm == ODP_SHM_INVALID) { - ODP_ERR("Shm reserve failed for odp_ipsec\n"); + _ODP_ERR("Shm reserve failed for odp_ipsec\n"); return -1; } ipsec_global = odp_shm_addr(shm); if (ipsec_global == NULL) { - ODP_ERR("ipsec: odp_shm_addr() failed\n"); + _ODP_ERR("ipsec: odp_shm_addr() failed\n"); odp_shm_free(shm); return -1; } @@ -2467,7 +2467,7 @@ int _odp_ipsec_term_global(void) shm = odp_shm_lookup("_odp_ipsec_global"); if (shm == ODP_SHM_INVALID || odp_shm_free(shm)) { - ODP_ERR("Shm free failed for odp_ipsec"); + _ODP_ERR("Shm free failed for odp_ipsec"); return -1; } @@ -2476,16 +2476,16 @@ int _odp_ipsec_term_global(void) void odp_ipsec_print(void) { - ODP_PRINT("\nIPSEC print\n"); - ODP_PRINT("-----------\n"); - ODP_PRINT(" max number of SA %u\n\n", ipsec_config->max_num_sa); + _ODP_PRINT("\nIPSEC print\n"); + _ODP_PRINT("-----------\n"); + _ODP_PRINT(" max number of SA %u\n\n", ipsec_config->max_num_sa); } void odp_ipsec_sa_print(odp_ipsec_sa_t sa) { ipsec_sa_t *ipsec_sa = _odp_ipsec_sa_entry_from_hdl(sa); - ODP_PRINT("\nIPSEC SA print\n"); - ODP_PRINT("--------------\n"); - ODP_PRINT(" SPI %u\n\n", ipsec_sa->spi); + _ODP_PRINT("\nIPSEC SA print\n"); + _ODP_PRINT("--------------\n"); + _ODP_PRINT(" SPI %u\n\n", ipsec_sa->spi); } diff --git a/platform/linux-generic/odp_ipsec_events.c b/platform/linux-generic/odp_ipsec_events.c index f229a5cf2..1220b0992 100644 --- a/platform/linux-generic/odp_ipsec_events.c +++ b/platform/linux-generic/odp_ipsec_events.c @@ -37,7 +37,7 @@ int _odp_ipsec_events_init_global(void) odp_pool_param_t param; if (odp_global_ro.disable.ipsec) { - ODP_PRINT("\nODP IPSec is DISABLED\n"); + _ODP_PRINT("\nODP IPSec is DISABLED\n"); return 0; } @@ -50,7 +50,7 @@ int _odp_ipsec_events_init_global(void) ipsec_status_pool = odp_pool_create("_odp_ipsec_status_pool", ¶m); if (ODP_POOL_INVALID == ipsec_status_pool) { - ODP_ERR("Error: status pool create failed.\n"); + _ODP_ERR("Error: status pool create failed.\n"); goto err_status; } @@ -69,7 +69,7 @@ int _odp_ipsec_events_term_global(void) ret = odp_pool_destroy(ipsec_status_pool); if (ret < 0) { - ODP_ERR("status pool destroy failed"); + _ODP_ERR("status pool destroy failed"); return -1; } @@ -78,15 +78,15 @@ int _odp_ipsec_events_term_global(void) ipsec_status_t _odp_ipsec_status_from_event(odp_event_t ev) { - ODP_ASSERT(ODP_EVENT_INVALID != ev); - ODP_ASSERT(ODP_EVENT_IPSEC_STATUS == odp_event_type(ev)); + _ODP_ASSERT(ODP_EVENT_INVALID != ev); + _ODP_ASSERT(ODP_EVENT_IPSEC_STATUS == odp_event_type(ev)); return (ipsec_status_t)ev; } static odp_event_t ipsec_status_to_event(ipsec_status_t status) { - ODP_ASSERT(ODP_IPSEC_STATUS_INVALID != status); + _ODP_ASSERT(ODP_IPSEC_STATUS_INVALID != status); return (odp_event_t)status; } diff --git a/platform/linux-generic/odp_ipsec_sad.c b/platform/linux-generic/odp_ipsec_sad.c index e689089d3..3097bef4b 100644 --- a/platform/linux-generic/odp_ipsec_sad.c +++ b/platform/linux-generic/odp_ipsec_sad.c @@ -133,7 +133,7 @@ static inline odp_ipsec_sa_t ipsec_sa_index_to_handle(uint32_t ipsec_sa_idx) ipsec_sa_t *_odp_ipsec_sa_entry_from_hdl(odp_ipsec_sa_t sa) { - ODP_ASSERT(ODP_IPSEC_SA_INVALID != sa); + _ODP_ASSERT(ODP_IPSEC_SA_INVALID != sa); return ipsec_sa_entry_from_hdl(sa); } @@ -171,7 +171,7 @@ int _odp_ipsec_sad_init_global(void) crypto_capa.max_sessions = 0; if (odp_crypto_capability(&crypto_capa)) { - ODP_ERR("odp_crypto_capability() failed\n"); + _ODP_ERR("odp_crypto_capability() failed\n"); return -1; } if (max_num_sa > crypto_capa.max_sessions) @@ -250,8 +250,7 @@ int _odp_ipsec_sad_term_global(void) if (odp_atomic_load_u32(&ipsec_sa->state) != IPSEC_SA_STATE_FREE) { - ODP_ERR("Not destroyed ipsec_sa: %u\n", - ipsec_sa->ipsec_sa_idx); + _ODP_ERR("Not destroyed ipsec_sa: %u\n", ipsec_sa->ipsec_sa_idx); rc = -1; } odp_atomic_store_u32(&ipsec_sa->state, IPSEC_SA_STATE_FREE); @@ -259,7 +258,7 @@ int _odp_ipsec_sad_term_global(void) ret = odp_shm_free(ipsec_sa_tbl->shm); if (ret < 0) { - ODP_ERR("shm free failed"); + _ODP_ERR("shm free failed"); rc = -1; } @@ -338,7 +337,7 @@ ipsec_sa_t *_odp_ipsec_sa_use(odp_ipsec_sa_t sa) { ipsec_sa_t *ipsec_sa; - ODP_ASSERT(ODP_IPSEC_SA_INVALID != sa); + _ODP_ASSERT(ODP_IPSEC_SA_INVALID != sa); ipsec_sa = ipsec_sa_entry_from_hdl(sa); @@ -354,7 +353,7 @@ void _odp_ipsec_sa_unuse(ipsec_sa_t *ipsec_sa) odp_ipsec_sa_t sa; odp_ipsec_warn_t warn = { .all = 0 }; - ODP_ASSERT(NULL != ipsec_sa); + _ODP_ASSERT(NULL != ipsec_sa); queue = ipsec_sa->queue; sa = ipsec_sa->ipsec_sa_hdl; @@ -433,7 +432,7 @@ static uint32_t esp_block_len_to_mask(uint32_t block_len) if (block_len < 4) block_len = 4; - ODP_ASSERT(_ODP_CHECK_IS_POWER2(block_len)); + _ODP_ASSERT(_ODP_CHECK_IS_POWER2(block_len)); return block_len - 1; } @@ -444,8 +443,8 @@ static int ipsec_antireplay_init(ipsec_sa_t *ipsec_sa, uint16_t num_bkts = 0; if (param->inbound.antireplay_ws > IPSEC_AR_WIN_SIZE_MAX) { - ODP_ERR("Anti-replay window size %" PRIu32 " is not supported.\n", - param->inbound.antireplay_ws); + _ODP_ERR("Anti-replay window size %" PRIu32 " is not supported.\n", + param->inbound.antireplay_ws); return -1; } @@ -499,7 +498,7 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const odp_ipsec_sa_param_t *param) ipsec_sa = ipsec_sa_reserve(); if (NULL == ipsec_sa) { - ODP_ERR("No more free SA\n"); + _ODP_ERR("No more free SA\n"); return ODP_IPSEC_SA_INVALID; } @@ -734,13 +733,12 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const odp_ipsec_sa_param_t *param) if (ipsec_sa->salt_length) { if (ipsec_sa->salt_length > IPSEC_MAX_SALT_LEN) { - ODP_ERR("IPSEC_MAX_SALT_LEN too small\n"); + _ODP_ERR("IPSEC_MAX_SALT_LEN too small\n"); goto error; } if (ipsec_sa->salt_length != salt_param->length) { - ODP_ERR("Bad extra keying material length: %i\n", - salt_param->length); + _ODP_ERR("Bad extra keying material length: %i\n", salt_param->length); goto error; } @@ -813,14 +811,13 @@ int odp_ipsec_sa_destroy(odp_ipsec_sa_t sa) uint32_t state = odp_atomic_load_u32(&ipsec_sa->state); if (IPSEC_SA_STATE_DISABLE != state) { - ODP_ERR("Distroying not disabled ipsec_sa: %u\n", - ipsec_sa->ipsec_sa_idx); + _ODP_ERR("Distroying not disabled ipsec_sa: %u\n", ipsec_sa->ipsec_sa_idx); return -1; } if (odp_crypto_session_destroy(ipsec_sa->session) < 0) { - ODP_ERR("Error destroying crypto session for ipsec_sa: %u\n", - ipsec_sa->ipsec_sa_idx); + _ODP_ERR("Error destroying crypto session for ipsec_sa: %u\n", + ipsec_sa->ipsec_sa_idx); rc = -1; } @@ -846,7 +843,7 @@ int odp_ipsec_sa_mtu_update(odp_ipsec_sa_t sa, uint32_t mtu) ipsec_sa_t *ipsec_sa; ipsec_sa = ipsec_sa_entry_from_hdl(sa); - ODP_ASSERT(NULL != ipsec_sa); + _ODP_ASSERT(NULL != ipsec_sa); odp_atomic_store_u32(&ipsec_sa->out.mtu, mtu); return 0; } @@ -1235,8 +1232,8 @@ int odp_ipsec_sa_info(odp_ipsec_sa_t sa, odp_ipsec_sa_info_t *sa_info) ipsec_sa = _odp_ipsec_sa_entry_from_hdl(sa); - ODP_ASSERT(ipsec_sa != NULL); - ODP_ASSERT(sa_info != NULL); + _ODP_ASSERT(ipsec_sa != NULL); + _ODP_ASSERT(sa_info != NULL); memset(sa_info, 0, sizeof(*sa_info)); param = &sa_info->param; diff --git a/platform/linux-generic/odp_ishm.c b/platform/linux-generic/odp_ishm.c index 0f7c48f35..2c4f364e3 100644 --- a/platform/linux-generic/odp_ishm.c +++ b/platform/linux-generic/odp_ishm.c @@ -258,14 +258,14 @@ static int hp_create_file(uint64_t len, const char *filename) void *addr; if (len <= 0) { - ODP_ERR("Length is wrong\n"); + _ODP_ERR("Length is wrong\n"); return -1; } fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (fd < 0) { - ODP_ERR("Could not create cache file %s\n", filename); + _ODP_ERR("Could not create cache file %s\n", filename); return -1; } @@ -275,13 +275,13 @@ static int hp_create_file(uint64_t len, const char *filename) ret = fallocate(fd, 0, 0, len); if (ret == -1) { if (errno == ENOTSUP) { - ODP_DBG("fallocate() not supported\n"); + _ODP_DBG("fallocate() not supported\n"); ret = ftruncate(fd, len); } if (ret == -1) { - ODP_ERR("memory allocation failed: fd=%d, err=%s.\n", - fd, strerror(errno)); + _ODP_ERR("memory allocation failed: fd=%d, err=%s.\n", + fd, strerror(errno)); close(fd); return -1; } @@ -296,7 +296,7 @@ static int hp_create_file(uint64_t len, const char *filename) } _odp_ishmphy_unmap(addr, len, 0); - ODP_DBG("Created HP cache file %s, fd: %d\n", filename, fd); + _ODP_DBG("Created HP cache file %s, fd: %d\n", filename, fd); return fd; } @@ -316,10 +316,10 @@ static void hp_init(void) if (count <= 0) return; - ODP_DBG("Init HP cache with up to %d pages\n", count); + _ODP_DBG("Init HP cache with up to %d pages\n", count); if (!odp_global_ro.hugepage_info.default_huge_page_dir) { - ODP_ERR("No huge page dir\n"); + _ODP_ERR("No huge page dir\n"); return; } @@ -329,7 +329,7 @@ static void hp_init(void) if (mkdir(dir, 0744) != 0) { if (errno != EEXIST) { - ODP_ERR("Failed to create dir: %s\n", strerror(errno)); + _ODP_ERR("Failed to create dir: %s\n", strerror(errno)); return; } } @@ -343,7 +343,7 @@ static void hp_init(void) sizeof(struct huge_page_cache) + sizeof(int) * count, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0); if (addr == MAP_FAILED) { - ODP_ERR("Unable to mmap memory for huge page cache\n."); + _ODP_ERR("Unable to mmap memory for huge page cache\n."); return; } @@ -369,8 +369,8 @@ static void hp_init(void) } hpc->idx = hpc->total - 1; - ODP_DBG("HP cache has %d huge pages of size 0x%08" PRIx64 "\n", - hpc->total, hpc->len); + _ODP_DBG("HP cache has %d huge pages of size 0x%08" PRIx64 "\n", + hpc->total, hpc->len); } static void hp_term(void) @@ -407,12 +407,12 @@ static int hp_get_cached(uint64_t len) static int hp_put_cached(int fd) { if (hpc == NULL) { - ODP_ERR("Bad hpc state\n"); + _ODP_ERR("Bad hpc state\n"); return -1; } if (odp_unlikely((hpc->idx + 1) >= hpc->total)) { - ODP_ERR("Trying to put more FD than allowed: %d\n", fd); + _ODP_ERR("Trying to put more FD than allowed: %d\n", fd); return -1; } @@ -463,7 +463,7 @@ static void *alloc_fragment(uintptr_t size, int block_index, intptr_t align, } if (!(*best_fragmnt)) { - ODP_ERR("Out of single VA memory. Try increasing " + _ODP_ERR("Out of single VA memory. Try increasing " "'shm.single_va_size_kb' in ODP config.\n"); return NULL; } @@ -480,7 +480,7 @@ static void *alloc_fragment(uintptr_t size, int block_index, intptr_t align, /* fragment space, i.e. take a new fragment descriptor... */ rem_fragmnt = ishm_ftbl->unused_fragmnts; if (!rem_fragmnt) { - ODP_ERR("unable to get shmem fragment descriptor!\n."); + _ODP_ERR("unable to get shmem fragment descriptor!\n."); return NULL; } ishm_ftbl->unused_fragmnts = rem_fragmnt->next; @@ -510,7 +510,7 @@ static void *alloc_fragment(uintptr_t size, int block_index, intptr_t align, /* otherwise, fragment space, i.e. take a new fragment descriptor... */ rem_fragmnt = ishm_ftbl->unused_fragmnts; if (!rem_fragmnt) { - ODP_ERR("unable to get shmem fragment descriptor!\n."); + _ODP_ERR("unable to get shmem fragment descriptor!\n."); return (*best_fragmnt)->start; } ishm_ftbl->unused_fragmnts = rem_fragmnt->next; @@ -562,7 +562,7 @@ static void free_fragment(ishm_fragment_t *fragmnt) if (ishm_ftbl->used_fragmnts == prev_f) ishm_ftbl->used_fragmnts = fragmnt; else - ODP_ERR("corrupted fragment list!.\n"); + _ODP_ERR("corrupted fragment list!.\n"); } fragmnt->prev = prev_f->prev; @@ -607,8 +607,7 @@ static int create_export_file(ishm_block_t *new_block, const char *name, name); export_file = fopen(new_block->exptname, "w"); if (export_file == NULL) { - ODP_ERR("open failed: err=%s.\n", - strerror(errno)); + _ODP_ERR("open failed: err=%s.\n", strerror(errno)); new_block->exptname[0] = 0; return -1; } @@ -688,7 +687,7 @@ static int create_file(int block_index, huge_flag_t huge, uint64_t len, fd = open(filename, oflag, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (fd < 0) { if (huge != HUGE) - ODP_ERR("Normal page open failed: file=%s, " + _ODP_ERR("Normal page open failed: file=%s, " "err=\"%s\"\n", filename, strerror(errno)); return -1; } @@ -696,12 +695,12 @@ static int create_file(int block_index, huge_flag_t huge, uint64_t len, ret = fallocate(fd, 0, 0, len); if (ret == -1) { if (errno == ENOTSUP) { - ODP_DBG("fallocate() not supported\n"); + _ODP_DBG("fallocate() not supported\n"); ret = ftruncate(fd, len); } if (ret == -1) { - ODP_ERR("%s memory allocation failed: fd=%d, file=%s, " + _ODP_ERR("%s memory allocation failed: fd=%d, file=%s, " "err=\"%s\"\n", (huge == HUGE) ? "Huge page" : "Normal page", fd, filename, strerror(errno)); close(fd); @@ -758,7 +757,7 @@ static void *do_map(int block_index, uint64_t len, uint32_t align, ishm_block_t *new_block; /* entry in the main block table */ void *mapped_addr; - ODP_ASSERT(!(flags & _ODP_ISHM_SINGLE_VA)); + _ODP_ASSERT(!(flags & _ODP_ISHM_SINGLE_VA)); new_block = &ishm_tbl->block[block_index]; @@ -827,7 +826,7 @@ static void *alloc_single_va(const char *name, int new_index, uint64_t size, /* Allocate memory from the pre-reserved single VA space */ addr = alloc_fragment(len, new_index, align, &fragment); if (!addr) { - ODP_ERR("alloc_fragment failed.\n"); + _ODP_ERR("alloc_fragment failed.\n"); return NULL; } new_block->fragment = fragment; @@ -865,7 +864,7 @@ static void *do_remap(int block_index, int fd) offset = ishm_tbl->block[block_index].offset; flags = ishm_tbl->block[block_index].flags; - ODP_ASSERT(!(flags & _ODP_ISHM_SINGLE_VA)); + _ODP_ASSERT(!(flags & _ODP_ISHM_SINGLE_VA)); /* try to mmap: */ mapped_addr = _odp_ishmphy_map(fd, len, offset, flags); @@ -988,7 +987,7 @@ static int block_free_internal(int block_index, int close_fd, int deregister) if ((block_index < 0) || (block_index >= ISHM_MAX_NB_BLOCKS) || (ishm_tbl->block[block_index].len == 0)) { - ODP_ERR("Request to free an invalid block\n"); + _ODP_ERR("Request to free an invalid block\n"); return -1; } @@ -1084,7 +1083,7 @@ int _odp_ishm_reserve(const char *name, uint64_t size, int fd, /* check if we have reached the maximum number of allocation: */ if (new_index >= ISHM_MAX_NB_BLOCKS) { odp_spinlock_unlock(&ishm_tbl->lock); - ODP_ERR("ISHM_MAX_NB_BLOCKS limit reached!\n"); + _ODP_ERR("ISHM_MAX_NB_BLOCKS limit reached!\n"); return -1; } @@ -1112,7 +1111,7 @@ int _odp_ishm_reserve(const char *name, uint64_t size, int fd, &fd); if (addr == NULL) { odp_spinlock_unlock(&ishm_tbl->lock); - ODP_ERR("_ishm_reserve failed.\n"); + _ODP_ERR("_ishm_reserve failed.\n"); return -1; } new_block->huge = EXTERNAL; @@ -1149,8 +1148,7 @@ int _odp_ishm_reserve(const char *name, uint64_t size, int fd, addr = do_map(new_index, len, hp_align, 0, flags, CACHED, &fd); if (addr == NULL) { - ODP_ERR("Could not use cached hp %d\n", - fd); + _ODP_ERR("Could not use cached hp %d\n", fd); hp_put_cached(fd); fd = -1; } else { @@ -1163,9 +1161,9 @@ int _odp_ishm_reserve(const char *name, uint64_t size, int fd, if (addr == NULL) { if (!huge_error_printed) { - ODP_ERR("No huge pages, fall back to " - "normal pages. Check: " - "/proc/sys/vm/nr_hugepages.\n"); + _ODP_ERR("No huge pages, fall back to " + "normal pages. Check: " + "/proc/sys/vm/nr_hugepages.\n"); huge_error_printed = 1; } } else { @@ -1178,7 +1176,7 @@ int _odp_ishm_reserve(const char *name, uint64_t size, int fd, if (fd < 0) { if (user_flags & ODP_SHM_HP) { odp_spinlock_unlock(&ishm_tbl->lock); - ODP_ERR("Unable to allocate memory from huge pages\n"); + _ODP_ERR("Unable to allocate memory from huge pages\n"); return -1; } /* at least, alignment in VA should match page size, but user @@ -1216,7 +1214,7 @@ use_single_va: } delete_file(new_block); odp_spinlock_unlock(&ishm_tbl->lock); - ODP_ERR("_ishm_reserve failed.\n"); + _ODP_ERR("_ishm_reserve failed.\n"); return -1; } @@ -1277,7 +1275,7 @@ static void *reserve_single_va(uint64_t size, int *fd_out) } } if (fd < 0) - ODP_ERR("No huge pages, fall back to normal pages. " + _ODP_ERR("No huge pages, fall back to normal pages. " "Check: /proc/sys/vm/nr_hugepages.\n"); ishm_tbl->single_va_huge = true; } @@ -1299,7 +1297,7 @@ static void *reserve_single_va(uint64_t size, int *fd_out) close(fd); unlink(ishm_tbl->single_va_filename); } - ODP_ERR("Reserving single VA memory failed.\n"); + _ODP_ERR("Reserving single VA memory failed.\n"); return NULL; } @@ -1339,7 +1337,7 @@ int _odp_ishm_find_exported(const char *remote_name, pid_t external_odp_pid, export_file = fopen(export_filename, "r"); if (export_file == NULL) { - ODP_ERR("Error opening %s.\n", export_filename); + _ODP_ERR("Error opening %s.\n", export_filename); return -1; } @@ -1375,8 +1373,7 @@ int _odp_ishm_find_exported(const char *remote_name, pid_t external_odp_pid, /* now open the filename given in the description file: */ fd = open(filename, O_RDWR, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (fd == -1) { - ODP_ERR("open failed for %s: %s.\n", - filename, strerror(errno)); + _ODP_ERR("open failed for %s: %s.\n", filename, strerror(errno)); return -1; } @@ -1404,7 +1401,7 @@ int _odp_ishm_find_exported(const char *remote_name, pid_t external_odp_pid, error_exp_file: fclose(export_file); - ODP_ERR("Error reading %s.\n", export_filename); + _ODP_ERR("Error reading %s.\n", export_filename); return -1; } @@ -1454,7 +1451,7 @@ static void *block_lookup(int block_index) if ((block_index < 0) || (block_index >= ISHM_MAX_NB_BLOCKS) || (ishm_tbl->block[block_index].len == 0)) { - ODP_ERR("Request to lookup an invalid block\n"); + _ODP_ERR("Request to lookup an invalid block\n"); return NULL; } @@ -1466,7 +1463,7 @@ static void *block_lookup(int block_index) /* this ishm is not known by this process, yet: we create the mapping.*/ fd = _odp_fdserver_lookup_fd(FD_SRV_CTX_ISHM, block_index); if (fd < 0) { - ODP_ERR("Could not find ishm file descriptor (BUG!)\n"); + _ODP_ERR("Could not find ishm file descriptor (BUG!)\n"); return NULL; } @@ -1480,7 +1477,7 @@ static void *block_lookup(int block_index) mapped_addr = do_remap(block_index, fd); if (mapped_addr == NULL) { - ODP_ERR(" lookup: Could not map existing shared memory!\n"); + _ODP_ERR(" lookup: Could not map existing shared memory!\n"); return NULL; } @@ -1545,7 +1542,7 @@ int _odp_ishm_info(int block_index, _odp_ishm_info_t *info) (block_index >= ISHM_MAX_NB_BLOCKS) || (ishm_tbl->block[block_index].len == 0)) { odp_spinlock_unlock(&ishm_tbl->lock); - ODP_ERR("Request for info on an invalid block\n"); + _ODP_ERR("Request for info on an invalid block\n"); return -1; } @@ -1631,8 +1628,7 @@ int _odp_ishm_cleanup_files(const char *dirpath) dir = opendir(userdir); if (!dir) { /* ok if the dir does not exist. no much to delete then! */ - ODP_DBG("opendir failed for %s: %s\n", - userdir, strerror(errno)); + _ODP_DBG("opendir failed for %s: %s\n", userdir, strerror(errno)); return 0; } snprintf(prefix, PATH_MAX, _ODP_FILES_FMT, odp_global_ro.main_pid); @@ -1647,10 +1643,9 @@ int _odp_ishm_cleanup_files(const char *dirpath) } snprintf(fullpath, PATH_MAX, "%s/%s", userdir, e->d_name); - ODP_DBG("deleting obsolete file: %s\n", fullpath); + _ODP_DBG("deleting obsolete file: %s\n", fullpath); if (unlink(fullpath)) - ODP_ERR("unlink failed for %s: %s\n", - fullpath, strerror(errno)); + _ODP_ERR("unlink failed for %s: %s\n", fullpath, strerror(errno)); free(fullpath); } } @@ -1673,23 +1668,23 @@ int _odp_ishm_init_global(const odp_init_t *init) if (!_odp_libconfig_lookup_ext_int("shm", NULL, "single_va_size_kb", &val_kb)) { - ODP_ERR("Unable to read single VA size from config\n"); + _ODP_ERR("Unable to read single VA size from config\n"); return -1; } - ODP_DBG("Shm single VA size: %dkB\n", val_kb); + _ODP_DBG("Shm single VA size: %dkB\n", val_kb); max_memory = (uint64_t)val_kb * 1024; internal = max_memory / 8; if (!_odp_libconfig_lookup_ext_int("shm", NULL, "huge_page_limit_kb", &val_kb)) { - ODP_ERR("Unable to read huge page usage limit from config\n"); + _ODP_ERR("Unable to read huge page usage limit from config\n"); return -1; } huge_page_limit = (uint64_t)val_kb * 1024; - ODP_DBG("Shm huge page usage limit: %dkB\n", val_kb); + _ODP_DBG("Shm huge page usage limit: %dkB\n", val_kb); /* user requested memory size + some extra for internal use */ if (init && init->shm.max_memory) @@ -1709,22 +1704,22 @@ int _odp_ishm_init_global(const odp_init_t *init) odp_global_ro.shm_dir_from_env = 0; } - ODP_DBG("ishm: using dir %s\n", odp_global_ro.shm_dir); + _ODP_DBG("ishm: using dir %s\n", odp_global_ro.shm_dir); uid = getuid(); snprintf(odp_global_ro.uid, UID_MAXLEN, "%d", uid); if ((syscall(SYS_gettid)) != odp_global_ro.main_pid) { - ODP_ERR("ishm init must be performed by the main " + _ODP_ERR("ishm init must be performed by the main " "ODP process!\n."); return -1; } if (!hp_dir) { - ODP_DBG("NOTE: No support for huge pages\n"); + _ODP_DBG("NOTE: No support for huge pages\n"); } else { - ODP_DBG("Huge pages mount point is: %s\n", hp_dir); + _ODP_DBG("Huge pages mount point is: %s\n", hp_dir); _odp_ishm_cleanup_files(hp_dir); } @@ -1734,7 +1729,7 @@ int _odp_ishm_init_global(const odp_init_t *init) addr = mmap(NULL, sizeof(ishm_table_t), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0); if (addr == MAP_FAILED) { - ODP_ERR("unable to mmap the main block table\n."); + _ODP_ERR("unable to mmap the main block table\n."); goto init_glob_err1; } ishm_tbl = addr; @@ -1748,7 +1743,7 @@ int _odp_ishm_init_global(const odp_init_t *init) addr = mmap(NULL, sizeof(ishm_ftable_t), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0); if (addr == MAP_FAILED) { - ODP_ERR("unable to mmap the main fragment table\n."); + _ODP_ERR("unable to mmap the main fragment table\n."); goto init_glob_err2; } ishm_ftbl = addr; @@ -1760,7 +1755,7 @@ int _odp_ishm_init_global(const odp_init_t *init) spce_addr = reserve_single_va(max_memory, &ishm_tbl->single_va_fd); if (!spce_addr) { - ODP_ERR("unable to reserve single VA memory\n."); + _ODP_ERR("unable to reserve single VA memory\n."); goto init_glob_err3; } ishm_tbl->single_va_start = spce_addr; @@ -1790,7 +1785,7 @@ int _odp_ishm_init_global(const odp_init_t *init) * indeed assume the availability of odp_shm_reserve()...: */ if (do_odp_ishm_init_local()) { - ODP_ERR("unable to init the main thread\n."); + _ODP_ERR("unable to init the main thread\n."); goto init_glob_err4; } @@ -1804,13 +1799,13 @@ int _odp_ishm_init_global(const odp_init_t *init) init_glob_err4: if (_odp_ishmphy_free_single_va()) - ODP_ERR("unable to free single VA memory\n."); + _ODP_ERR("unable to free single VA memory\n."); init_glob_err3: if (munmap(ishm_ftbl, sizeof(ishm_ftable_t)) < 0) - ODP_ERR("unable to munmap main fragment table\n."); + _ODP_ERR("unable to munmap main fragment table\n."); init_glob_err2: if (munmap(ishm_tbl, sizeof(ishm_table_t)) < 0) - ODP_ERR("unable to munmap main block table\n."); + _ODP_ERR("unable to munmap main block table\n."); init_glob_err1: return -1; } @@ -1866,7 +1861,7 @@ static int do_odp_ishm_term_local(void) block = &ishm_tbl->block[block_index]; if ((--block->refcnt) <= 0) { block->refcnt = 0; - ODP_DBG("Warning: block %d: name:%s " + _ODP_DBG("Warning: block %d: name:%s " "no longer referenced\n", i, ishm_tbl->block[i].name[0] ? @@ -1907,14 +1902,14 @@ int _odp_ishm_term_global(void) if ((getpid() != odp_global_ro.main_pid) || (syscall(SYS_gettid) != getpid())) - ODP_ERR("odp_term_global() must be performed by the main " + _ODP_ERR("odp_term_global() must be performed by the main " "ODP process!\n."); /* cleanup possibly non freed memory (and complain a bit): */ for (index = 0; index < ISHM_MAX_NB_BLOCKS; index++) { block = &ishm_tbl->block[index]; if (block->len != 0) { - ODP_ERR("block '%s' (file %s) was never freed " + _ODP_ERR("block '%s' (file %s) was never freed " "(cleaning up...).\n", block->name, block->filename); delete_file(block); @@ -1930,12 +1925,12 @@ int _odp_ishm_term_global(void) /* free the fragment table */ if (munmap(ishm_ftbl, sizeof(ishm_ftable_t)) < 0) { ret |= -1; - ODP_ERR("unable to munmap fragment table\n."); + _ODP_ERR("unable to munmap fragment table\n."); } /* free the block table */ if (munmap(ishm_tbl, sizeof(ishm_table_t)) < 0) { ret |= -1; - ODP_ERR("unable to munmap main table\n."); + _ODP_ERR("unable to munmap main table\n."); } /* free the reserved single VA memory */ @@ -1943,7 +1938,7 @@ int _odp_ishm_term_global(void) ret |= -1; if ((fd >= 0) && close(fd)) { ret |= -1; - ODP_ERR("unable to close single VA\n."); + _ODP_ERR("unable to close single VA\n."); } if (!odp_global_ro.shm_dir_from_env) @@ -1995,10 +1990,10 @@ int _odp_ishm_status(const char *title) max_name_len = str_len; } - ODP_PRINT("%s\n", title); - ODP_PRINT(" %-*s flag %-29s %-8s %-8s %-3s %-3s %-3s file\n", - max_name_len, "name", "range", "user_len", "unused", - "seq", "ref", "fd"); + _ODP_PRINT("%s\n", title); + _ODP_PRINT(" %-*s flag %-29s %-8s %-8s %-3s %-3s %-3s file\n", + max_name_len, "name", "range", "user_len", "unused", + "seq", "ref", "fd"); /* display block table: 1 line per entry +1 extra line if mapped here */ for (i = 0; i < ISHM_MAX_NB_BLOCKS; i++) { @@ -2046,7 +2041,7 @@ int _odp_ishm_status(const char *title) entry_fd = ishm_proctable->entry[proc_index].fd; } - ODP_PRINT("%2i %-*s %s%c %p-%p %-8" PRIu64 " " + _ODP_PRINT("%2i %-*s %s%c %p-%p %-8" PRIu64 " " "%-8" PRIu64 " %-3" PRIu64 " %-3" PRIu64 " " "%-3d %s\n", i, max_name_len, ishm_tbl->block[i].name, @@ -2060,39 +2055,39 @@ int _odp_ishm_status(const char *title) ishm_tbl->block[i].filename : "(none)"); } - ODP_PRINT("TOTAL: %58s%-8" PRIu64 " %2s%-8" PRIu64 "\n", - "", len_total, - "", lost_total); - ODP_PRINT("%65s(%" PRIu64 "MB) %4s(%" PRIu64 "MB)\n", - "", len_total / 1024 / 1024, - "", lost_total / 1024 / 1024); + _ODP_PRINT("TOTAL: %58s%-8" PRIu64 " %2s%-8" PRIu64 "\n", + "", len_total, + "", lost_total); + _ODP_PRINT("%65s(%" PRIu64 "MB) %4s(%" PRIu64 "MB)\n", + "", len_total / 1024 / 1024, + "", lost_total / 1024 / 1024); /* display the virtual space allocations... : */ - ODP_PRINT("\nishm virtual space:\n"); + _ODP_PRINT("\nishm virtual space:\n"); for (fragmnt = ishm_ftbl->used_fragmnts; fragmnt; fragmnt = fragmnt->next) { if (fragmnt->block_index >= 0) { nb_allocated_frgments++; - ODP_PRINT(" %8p - %8p: ALLOCATED by block:%d\n", - fragmnt->start, - (void *)((uintptr_t)fragmnt->start + fragmnt->len - 1), - fragmnt->block_index); + _ODP_PRINT(" %8p - %8p: ALLOCATED by block:%d\n", + fragmnt->start, + (void *)((uintptr_t)fragmnt->start + fragmnt->len - 1), + fragmnt->block_index); consecutive_unallocated = 0; } else { - ODP_PRINT(" %8p - %8p: NOT ALLOCATED\n", - fragmnt->start, - (void *)((uintptr_t)fragmnt->start + fragmnt->len - 1)); + _ODP_PRINT(" %8p - %8p: NOT ALLOCATED\n", + fragmnt->start, + (void *)((uintptr_t)fragmnt->start + fragmnt->len - 1)); if (consecutive_unallocated++) - ODP_ERR("defragmentation error\n"); + _ODP_ERR("defragmentation error\n"); } /* some other sanity checks: */ if (fragmnt->prev != previous) - ODP_ERR("chaining error\n"); + _ODP_ERR("chaining error\n"); if (fragmnt != ishm_ftbl->used_fragmnts) { if ((uintptr_t)fragmnt->start != last_address + 1) - ODP_ERR("lost space error\n"); + _ODP_ERR("lost space error\n"); } last_address = (uintptr_t)fragmnt->start + fragmnt->len - 1; @@ -2105,24 +2100,24 @@ int _odp_ishm_status(const char *title) * the number of used fragments: */ if (single_va_blocks != nb_allocated_frgments) - ODP_ERR("single_va_blocks != nb_allocated_fragments!\n"); + _ODP_ERR("single_va_blocks != nb_allocated_fragments!\n"); /* compute the number of unused fragments*/ for (fragmnt = ishm_ftbl->unused_fragmnts; fragmnt; fragmnt = fragmnt->next) nb_unused_frgments++; - ODP_PRINT("ishm: %d fragment used. %d fragments unused. (total=%d)\n", - nb_used_frgments, nb_unused_frgments, - nb_used_frgments + nb_unused_frgments); + _ODP_PRINT("ishm: %d fragment used. %d fragments unused. (total=%d)\n", + nb_used_frgments, nb_unused_frgments, + nb_used_frgments + nb_unused_frgments); if ((nb_used_frgments + nb_unused_frgments) != ISHM_NB_FRAGMNTS) - ODP_ERR("lost fragments!\n"); + _ODP_ERR("lost fragments!\n"); if (nb_blocks < ishm_proctable->nb_entries) - ODP_ERR("process known block cannot exceed main total sum!\n"); + _ODP_ERR("process known block cannot exceed main total sum!\n"); - ODP_PRINT("\n"); + _ODP_PRINT("\n"); odp_spinlock_unlock(&ishm_tbl->lock); return nb_blocks; @@ -2139,21 +2134,21 @@ void _odp_ishm_print(int block_index) (block_index >= ISHM_MAX_NB_BLOCKS) || (ishm_tbl->block[block_index].len == 0)) { odp_spinlock_unlock(&ishm_tbl->lock); - ODP_ERR("Request for info on an invalid block\n"); + _ODP_ERR("Request for info on an invalid block\n"); return; } block = &ishm_tbl->block[block_index]; - ODP_PRINT("\nSHM block info\n--------------\n"); - ODP_PRINT(" name: %s\n", block->name); - ODP_PRINT(" file: %s\n", block->filename); - ODP_PRINT(" expt: %s\n", block->exptname); - ODP_PRINT(" user_flags: 0x%x\n", block->user_flags); - ODP_PRINT(" flags: 0x%x\n", block->flags); - ODP_PRINT(" user_len: %" PRIu64 "\n", block->user_len); - ODP_PRINT(" start: %p\n", block->start); - ODP_PRINT(" len: %" PRIu64 "\n", block->len); + _ODP_PRINT("\nSHM block info\n--------------\n"); + _ODP_PRINT(" name: %s\n", block->name); + _ODP_PRINT(" file: %s\n", block->filename); + _ODP_PRINT(" expt: %s\n", block->exptname); + _ODP_PRINT(" user_flags: 0x%x\n", block->user_flags); + _ODP_PRINT(" flags: 0x%x\n", block->flags); + _ODP_PRINT(" user_len: %" PRIu64 "\n", block->user_len); + _ODP_PRINT(" start: %p\n", block->start); + _ODP_PRINT(" len: %" PRIu64 "\n", block->len); switch (block->huge) { case HUGE: @@ -2172,10 +2167,10 @@ void _odp_ishm_print(int block_index) str = "??"; } - ODP_PRINT(" page type: %s\n", str); - ODP_PRINT(" seq: %" PRIu64 "\n", block->seq); - ODP_PRINT(" refcnt: %" PRIu64 "\n", block->refcnt); - ODP_PRINT("\n"); + _ODP_PRINT(" page type: %s\n", str); + _ODP_PRINT(" seq: %" PRIu64 "\n", block->seq); + _ODP_PRINT(" refcnt: %" PRIu64 "\n", block->refcnt); + _ODP_PRINT("\n"); odp_spinlock_unlock(&ishm_tbl->lock); } diff --git a/platform/linux-generic/odp_ishmphy.c b/platform/linux-generic/odp_ishmphy.c index efaf12c7b..796482b98 100644 --- a/platform/linux-generic/odp_ishmphy.c +++ b/platform/linux-generic/odp_ishmphy.c @@ -51,14 +51,14 @@ void *_odp_ishmphy_reserve_single_va(uint64_t len, int fd) addr = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, fd, 0); if (addr == MAP_FAILED) { - ODP_ERR("mmap failed: %s\n", strerror(errno)); + _ODP_ERR("mmap failed: %s\n", strerror(errno)); return NULL; } if (mprotect(addr, len, PROT_READ | PROT_WRITE)) - ODP_ERR("mprotect failed: %s\n", strerror(errno)); + _ODP_ERR("mprotect failed: %s\n", strerror(errno)); - ODP_DBG("VA Reserved: %p, len=%" PRIu64 "\n", addr, len); + _ODP_DBG("VA Reserved: %p, len=%" PRIu64 "\n", addr, len); common_va_address = addr; common_va_len = len; @@ -79,7 +79,7 @@ int _odp_ishmphy_free_single_va(void) ret = munmap(common_va_address, common_va_len); if (ret) - ODP_ERR("munmap failed: %s\n", strerror(errno)); + _ODP_ERR("munmap failed: %s\n", strerror(errno)); return ret; } @@ -94,7 +94,7 @@ void *_odp_ishmphy_map(int fd, uint64_t size, uint64_t offset, int flags) void *mapped_addr; int mmap_flags = MAP_POPULATE; - ODP_ASSERT(!(flags & _ODP_ISHM_SINGLE_VA)); + _ODP_ASSERT(!(flags & _ODP_ISHM_SINGLE_VA)); /* do a new mapping in the VA space: */ mapped_addr = mmap(NULL, size, PROT_READ | PROT_WRITE, @@ -102,7 +102,7 @@ void *_odp_ishmphy_map(int fd, uint64_t size, uint64_t offset, int flags) if ((mapped_addr >= common_va_address) && ((char *)mapped_addr < (char *)common_va_address + common_va_len)) { - ODP_ERR("VA SPACE OVERLAP!\n"); + _ODP_ERR("VA SPACE OVERLAP!\n"); } if (mapped_addr == MAP_FAILED) @@ -111,9 +111,9 @@ void *_odp_ishmphy_map(int fd, uint64_t size, uint64_t offset, int flags) /* if locking is requested, lock it...*/ if (flags & _ODP_ISHM_LOCK) { if (mlock(mapped_addr, size)) { - ODP_ERR("mlock failed: %s\n", strerror(errno)); + _ODP_ERR("mlock failed: %s\n", strerror(errno)); if (munmap(mapped_addr, size)) - ODP_ERR("munmap failed: %s\n", strerror(errno)); + _ODP_ERR("munmap failed: %s\n", strerror(errno)); return NULL; } } @@ -140,6 +140,6 @@ int _odp_ishmphy_unmap(void *start, uint64_t len, int flags) /* just release the mapping */ ret = munmap(start, len); if (ret) - ODP_ERR("munmap failed: %s\n", strerror(errno)); + _ODP_ERR("munmap failed: %s\n", strerror(errno)); return ret; } diff --git a/platform/linux-generic/odp_ishmpool.c b/platform/linux-generic/odp_ishmpool.c index 4186444fa..5bcb2c2ea 100644 --- a/platform/linux-generic/odp_ishmpool.c +++ b/platform/linux-generic/odp_ishmpool.c @@ -157,7 +157,7 @@ static inline void remove_from_list(pool_t *bpool, uint8_t order, } remove_from_list_error: - ODP_ERR("List corrupted\n"); + _ODP_ERR("List corrupted\n"); } /* @@ -227,13 +227,13 @@ static pool_t *_odp_ishmbud_pool_create(const char *pool_name, int store_idx, blk_idx = _odp_ishm_reserve(pool_name, total_sz, -1, ODP_CACHE_LINE_SIZE, 0, flags, 0); if (blk_idx < 0) { - ODP_ERR("_odp_ishm_reserve failed."); + _ODP_ERR("_odp_ishm_reserve failed."); return NULL; } bpool = _odp_ishm_address(blk_idx); if (bpool == NULL) { - ODP_ERR("_odp_ishm_address failed."); + _ODP_ERR("_odp_ishm_address failed."); return NULL; } @@ -284,7 +284,7 @@ static void *_odp_ishmbud_alloc(pool_t *bpool, uint64_t size) /* if size is zero or too big reject: */ if ((!size) && (size > (1ULL << bpool->ctrl.order))) { - ODP_ERR("Invalid alloc size (0 or larger than whole pool)\n"); + _ODP_ERR("Invalid alloc size (0 or larger than whole pool)\n"); return NULL; } @@ -314,7 +314,7 @@ static void *_odp_ishmbud_alloc(pool_t *bpool, uint64_t size) if (!bblock) { odp_spinlock_unlock(&bpool->ctrl.lock); - ODP_ERR("Out of memory. (Buddy pool full)\n"); + _ODP_ERR("Out of memory. (Buddy pool full)\n"); return NULL; } @@ -366,7 +366,7 @@ static int _odp_ishmbud_free(pool_t *bpool, void *addr) if (((uintptr_t)addr < user_start) || ((uintptr_t)addr > user_stop) || (((uintptr_t)addr - user_start) & mask)) { - ODP_ERR("Invalid address to be freed\n"); + _ODP_ERR("Invalid address to be freed\n"); return -1; } @@ -378,7 +378,7 @@ static int _odp_ishmbud_free(pool_t *bpool, void *addr) nr = get_bblock_nr(bpool, bblock); order = bpool->ctrl.alloced_order[nr]; if (order == BBLOCK_FREE) { - ODP_ERR("Double free error\n"); + _ODP_ERR("Double free error\n"); odp_spinlock_unlock(&bpool->ctrl.lock); return -1; } @@ -470,13 +470,13 @@ static pool_t *_odp_ishmslab_pool_create(const char *pool_name, int store_idx, blk_idx = _odp_ishm_reserve(pool_name, total_sz, -1, ODP_CACHE_LINE_SIZE, 0, flags, 0); if (blk_idx < 0) { - ODP_ERR("_odp_ishm_reserve failed."); + _ODP_ERR("_odp_ishm_reserve failed."); return NULL; } spool = _odp_ishm_address(blk_idx); if (spool == NULL) { - ODP_ERR("_odp_ishm_address failed."); + _ODP_ERR("_odp_ishm_address failed."); return NULL; } @@ -525,7 +525,7 @@ static void *_odp_ishmslab_alloc(pool_t *spool, uint64_t size) ret = spool->ctrl.free_head; if (!ret) { odp_spinlock_unlock(&spool->ctrl.lock); - ODP_ERR("Out of memory. (Slab pool full)\n"); + _ODP_ERR("Out of memory. (Slab pool full)\n"); return NULL; } @@ -555,7 +555,7 @@ static int _odp_ishmslab_free(pool_t *spool, void *addr) if (((uintptr_t)addr < user_start) || ((uintptr_t)addr > user_stop) || (((uintptr_t)addr - user_start) % spool->ctrl.element_sz)) { - ODP_ERR("Invalid address to be freed\n"); + _ODP_ERR("Invalid address to be freed\n"); return -1; } @@ -579,7 +579,7 @@ pool_t *_odp_ishm_pool_create(const char *pool_name, uint64_t size, uint64_t real_pool_sz; if (min_alloc > max_alloc) { - ODP_ERR("invalid parameter: min_alloc > max_alloc"); + _ODP_ERR("invalid parameter: min_alloc > max_alloc"); return NULL; } @@ -589,7 +589,7 @@ pool_t *_odp_ishm_pool_create(const char *pool_name, uint64_t size, break; } if (store_idx == MAX_NB_POOL) { - ODP_ERR("Max number of pool reached (MAX_NB_POOL)"); + _ODP_ERR("Max number of pool reached (MAX_NB_POOL)"); return NULL; } diff --git a/platform/linux-generic/odp_libconfig.c b/platform/linux-generic/odp_libconfig.c index 87a41deb8..d5e159e21 100644 --- a/platform/linux-generic/odp_libconfig.c +++ b/platform/linux-generic/odp_libconfig.c @@ -34,9 +34,9 @@ int _odp_libconfig_init_global(void) odp_global_ro.has_config_rt = 0; if (!config_read_string(config, config_builtin)) { - ODP_ERR("Failed to read default config: %s(%d): %s\n", - config_error_file(config), config_error_line(config), - config_error_text(config)); + _ODP_ERR("Failed to read default config: %s(%d): %s\n", + config_error_file(config), config_error_line(config), + config_error_text(config)); goto fail; } @@ -44,46 +44,44 @@ int _odp_libconfig_init_global(void) if (filename == NULL) return 0; - ODP_PRINT("ODP CONFIG FILE: %s\n", filename); + _ODP_PRINT("ODP CONFIG FILE: %s\n", filename); if (!config_read_file(config_rt, filename)) { - ODP_PRINT(" ERROR: failed to read config file: %s(%d): %s\n\n", - config_error_file(config_rt), - config_error_line(config_rt), - config_error_text(config_rt)); + _ODP_PRINT(" ERROR: failed to read config file: %s(%d): %s\n\n", + config_error_file(config_rt), + config_error_line(config_rt), + config_error_text(config_rt)); goto fail; } /* Check runtime configuration's implementation name and version */ if (!config_lookup_string(config, impl_field, &impl) || !config_lookup_string(config_rt, impl_field, &impl_rt)) { - ODP_PRINT(" ERROR: missing mandatory field: %s\n\n", - impl_field); + _ODP_PRINT(" ERROR: missing mandatory field: %s\n\n", impl_field); goto fail; } if (!config_lookup_string(config, vers_field, &vers) || !config_lookup_string(config_rt, vers_field, &vers_rt)) { - ODP_PRINT(" ERROR: missing mandatory field: %s\n\n", - vers_field); + _ODP_PRINT(" ERROR: missing mandatory field: %s\n\n", vers_field); goto fail; } if (strcmp(impl, impl_rt)) { - ODP_PRINT(" ERROR: ODP implementation name mismatch:\n" - " Expected: \"%s\"\n" - " Found: \"%s\"\n\n", impl, impl_rt); + _ODP_PRINT(" ERROR: ODP implementation name mismatch:\n" + " Expected: \"%s\"\n" + " Found: \"%s\"\n\n", impl, impl_rt); goto fail; } if (strcmp(vers, vers_rt)) { - ODP_PRINT(" ERROR: config file version number mismatch:\n" - " Expected: \"%s\"\n" - " Found: \"%s\"\n\n", vers, vers_rt); + _ODP_PRINT(" ERROR: config file version number mismatch:\n" + " Expected: \"%s\"\n" + " Found: \"%s\"\n\n", vers, vers_rt); goto fail; } odp_global_ro.has_config_rt = 1; return 0; fail: - ODP_ERR("Config file failure\n"); + _ODP_ERR("Config file failure\n"); config_destroy(config); config_destroy(config_rt); return -1; @@ -133,8 +131,7 @@ int _odp_libconfig_lookup_str(const char *path, char *value, return length; if (length > str_size) { - ODP_ERR("libconfig: length of %d bigger than size %u\n", - length, str_size); + _ODP_ERR("libconfig: length of %d bigger than size %u\n", length, str_size); return -1; } @@ -142,7 +139,7 @@ int _odp_libconfig_lookup_str(const char *path, char *value, return length; } - ODP_ERR("libconfig: %s is not defined in config files\n", path); + _ODP_ERR("libconfig: %s is not defined in config files\n", path); return -1; } @@ -199,7 +196,7 @@ int _odp_libconfig_lookup_array_str(const char *path, char **value, /* invalid config if element is not an array */ if (config_setting_is_array(setting) == CONFIG_FALSE) { - ODP_ERR("libconfig: %s is not an array\n", path); + _ODP_ERR("libconfig: %s is not an array\n", path); return -1; } num = config_setting_length(setting); @@ -209,15 +206,15 @@ int _odp_libconfig_lookup_array_str(const char *path, char **value, elem = config_setting_get_elem(setting, 0); if (config_setting_type(elem) != CONFIG_TYPE_STRING) { - ODP_ERR("libconfig: %s array is not of type string\n", path); + _ODP_ERR("libconfig: %s array is not of type string\n", path); return -1; } for (j = 0; j < num; j++) { elem = config_setting_get_elem(setting, j); if (strlen(elem->value.sval) > str_size) { - ODP_ERR("libconfig: length of %s bigger than size %u\n", - elem->value.sval, str_size); + _ODP_ERR("libconfig: length of %s bigger than size %u\n", + elem->value.sval, str_size); return -1; } strcpy(value[j], elem->value.sval); @@ -226,7 +223,7 @@ int _odp_libconfig_lookup_array_str(const char *path, char **value, return num; } - ODP_ERR("libconfig: %s is not defined in config files\n", path); + _ODP_ERR("libconfig: %s is not defined in config files\n", path); return -1; } @@ -336,7 +333,7 @@ int _odp_libconfig_print(void) /* Print temp file to the log */ rewind(file); while ((c = fgetc(file)) != EOF) - ODP_PRINT("%c", (char)c); + _ODP_PRINT("%c", (char)c); fclose(file); return 0; diff --git a/platform/linux-generic/odp_name_table.c b/platform/linux-generic/odp_name_table.c index fbb35cf00..7c93d594b 100644 --- a/platform/linux-generic/odp_name_table.c +++ b/platform/linux-generic/odp_name_table.c @@ -223,20 +223,19 @@ static void secondary_hash_dump(secondary_hash_tbl_t *secondary_hash_tbl) entry_cnt = hash_tbl_entry & 0x3F; list_cnt = linked_list_len(name_tbl_entry); if (entry_cnt != list_cnt) - ODP_DBG("%s idx=%u entry_cnt=%u " + _ODP_DBG("%s idx=%u entry_cnt=%u " "list_cnt=%u\n", __func__, idx, entry_cnt, list_cnt); count += entry_cnt; } else { - ODP_DBG("%s inner secondary tbl\n", - __func__); + _ODP_DBG("%s inner secondary tbl\n", __func__); } } } - ODP_DBG("%s count=%u\n", __func__, count); + _ODP_DBG("%s count=%u\n", __func__, count); } static uint32_t name_tbl_free_list_add(name_tbl_t *name_tbl, @@ -1073,7 +1072,7 @@ static void secondary_hash_histo_print(void) if (name_hash_tbl.num_secondary_tbls[0] == 0) return; - ODP_DBG(" level1 secondary hash histogram:\n"); + _ODP_DBG(" level1 secondary hash histogram:\n"); total_count = 0; for (idx = 0; idx < 256; idx++) { count = level1_histo[idx]; @@ -1081,24 +1080,23 @@ static void secondary_hash_histo_print(void) total_count += count * idx; if (count != 0) - ODP_DBG(" num collisions=%02u count=%u\n", - idx, count); + _ODP_DBG(" num collisions=%02u count=%u\n", idx, count); } count = level1_histo[256]; total_count += count; if (count != 0) - ODP_DBG(" num collisions >=256 count=%u\n", count); + _ODP_DBG(" num collisions >=256 count=%u\n", count); avg = (100 * total_count) / name_hash_tbl.num_secondary_tbls[0]; avg = avg / SECONDARY_HASH_TBL_SIZE; - ODP_DBG(" avg collisions=%02u.%02u total=%u\n\n", - avg / 100, avg % 100, total_count); + _ODP_DBG(" avg collisions=%02u.%02u total=%u\n\n", + avg / 100, avg % 100, total_count); if (name_hash_tbl.num_secondary_tbls[1] == 0) return; - ODP_DBG(" level2 secondary hash histogram:\n"); + _ODP_DBG(" level2 secondary hash histogram:\n"); total_count = 0; for (idx = 0; idx < 256; idx++) { count = level2_histo[idx]; @@ -1106,19 +1104,18 @@ static void secondary_hash_histo_print(void) total_count += count * idx; if (count != 0) - ODP_DBG(" num collisions=%02u count=%u\n", - idx, count); + _ODP_DBG(" num collisions=%02u count=%u\n", idx, count); } count = level2_histo[256]; total_count += count; if (count != 0) - ODP_DBG(" num collisions >=256 count=%u\n", count); + _ODP_DBG(" num collisions >=256 count=%u\n", count); avg = (100 * total_count) / name_hash_tbl.num_secondary_tbls[1]; avg = avg / SECONDARY_HASH_TBL_SIZE; - ODP_DBG(" avg collisions=%02u.%02u total=%u\n\n", - avg / 100, avg % 100, total_count); + _ODP_DBG(" avg collisions=%02u.%02u total=%u\n\n", + avg / 100, avg % 100, total_count); } #endif @@ -1130,21 +1127,21 @@ void _odp_int_name_tbl_stats_print(void) count, total_count; uint32_t avg; - ODP_DBG("\nname table stats:\n"); - ODP_DBG(" num_names=%" PRIu32 " num_adds=%" PRIu64 " " - "num_deletes=%" PRIu64 " num_name_tbls=%" PRIu8 "\n", - name_tbls.current_num_names, name_tbls.num_adds, - name_tbls.num_deletes, name_tbls.num_name_tbls); + _ODP_DBG("\nname table stats:\n"); + _ODP_DBG(" num_names=%" PRIu32 " num_adds=%" PRIu64 " " + "num_deletes=%" PRIu64 " num_name_tbls=%" PRIu8 "\n", + name_tbls.current_num_names, name_tbls.num_adds, + name_tbls.num_deletes, name_tbls.num_name_tbls); for (idx = 0; idx < NUM_NAME_TBLS; idx++) { name_tbl = name_tbls.tbls[idx]; if ((name_tbl) && (name_tbl->num_used != 0)) - ODP_DBG(" name_tbl %u num_allocd=%7u " - "num_added_to_free_list=%7u " - "num_used=%7u num_avail_to_add=%7u\n", idx, - name_tbl->num_allocd, - name_tbl->num_added_to_free_list, - name_tbl->num_used, - name_tbl->num_avail_to_add); + _ODP_DBG(" name_tbl %u num_allocd=%7u " + "num_added_to_free_list=%7u " + "num_used=%7u num_avail_to_add=%7u\n", idx, + name_tbl->num_allocd, + name_tbl->num_added_to_free_list, + name_tbl->num_used, + name_tbl->num_avail_to_add); } memset(primary_hash_histo, 0, sizeof(primary_hash_histo)); @@ -1154,7 +1151,7 @@ void _odp_int_name_tbl_stats_print(void) primary_hash_histo[collisions]++; } - ODP_DBG(" name_tbl primary hash histogram:\n"); + _ODP_DBG(" name_tbl primary hash histogram:\n"); total_count = 0; for (idx = 0; idx < 256; idx++) { count = primary_hash_histo[idx]; @@ -1162,23 +1159,20 @@ void _odp_int_name_tbl_stats_print(void) total_count += count * idx; if (count != 0) - ODP_DBG(" num collisions=%02u count=%u\n", - idx, count); + _ODP_DBG(" num collisions=%02u count=%u\n", idx, count); } count = primary_hash_histo[256]; total_count += count; if (count != 0) - ODP_DBG(" num collisions >=256 count=%u\n", count); + _ODP_DBG(" num collisions >=256 count=%u\n", count); avg = (100 * total_count) / PRIMARY_HASH_TBL_SIZE; - ODP_DBG(" avg collisions=%02u.%02u total=%u\n\n", - avg / 100, avg % 100, total_count); + _ODP_DBG(" avg collisions=%02u.%02u total=%u\n\n", + avg / 100, avg % 100, total_count); - ODP_DBG(" num of first level secondary hash tbls=%u " - "second level tbls=%u\n", - name_hash_tbl.num_secondary_tbls[0], - name_hash_tbl.num_secondary_tbls[1]); + _ODP_DBG(" num of first level secondary hash tbls=%u second level tbls=%u\n", + name_hash_tbl.num_secondary_tbls[0], name_hash_tbl.num_secondary_tbls[1]); #ifdef SECONDARY_HASH_HISTO_PRINT if (name_hash_tbl.num_secondary_tbls[0] != 0) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index f8ceae35f..241c1c647 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -291,7 +291,7 @@ static inline void link_segments(odp_packet_hdr_t *pkt_hdr[], int num) ref_cnt = &pkt_hdr[cur]->ref_cnt; prev_ref = odp_atomic_fetch_inc_u32(ref_cnt); - ODP_ASSERT(prev_ref == 0); + _ODP_ASSERT(prev_ref == 0); } cur++; @@ -326,7 +326,7 @@ static inline void init_segments(odp_packet_hdr_t *pkt_hdr[], int num) uint32_t prev_ref = odp_atomic_fetch_inc_u32(&hdr->ref_cnt); - ODP_ASSERT(prev_ref == 0); + _ODP_ASSERT(prev_ref == 0); } /* Link segments */ @@ -694,7 +694,7 @@ void odp_packet_free(odp_packet_t pkt) odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); int num_seg = pkt_hdr->seg_count; - ODP_ASSERT(segment_ref(pkt_hdr) > 0); + _ODP_ASSERT(segment_ref(pkt_hdr) > 0); if (odp_likely(num_seg == 1)) packet_free_multi(&pkt_hdr, 1); @@ -712,7 +712,7 @@ void odp_packet_free_multi(const odp_packet_t pkt[], int num) odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt[i]); int num_seg = pkt_hdr->seg_count; - ODP_ASSERT(segment_ref(pkt_hdr) > 0); + _ODP_ASSERT(segment_ref(pkt_hdr) > 0); if (odp_unlikely(num_seg > 1)) { free_all_segments(pkt_hdr, num_seg); @@ -905,7 +905,7 @@ void *odp_packet_push_tail(odp_packet_t pkt, uint32_t len) if (len > pkt_hdr->tailroom) return NULL; - ODP_ASSERT(odp_packet_has_ref(pkt) == 0); + _ODP_ASSERT(odp_packet_has_ref(pkt) == 0); old_tail = packet_tail(pkt_hdr); push_tail(pkt_hdr, len); @@ -922,7 +922,7 @@ int odp_packet_extend_tail(odp_packet_t *pkt, uint32_t len, uint32_t tail_off = frame_len; int ret = 0; - ODP_ASSERT(odp_packet_has_ref(*pkt) == 0); + _ODP_ASSERT(odp_packet_has_ref(*pkt) == 0); if (len > tailroom) { pool_t *pool = _odp_pool_entry(pkt_hdr->event_hdr.pool); @@ -959,7 +959,7 @@ void *odp_packet_pull_tail(odp_packet_t pkt, uint32_t len) odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); odp_packet_hdr_t *last_seg = packet_last_seg(pkt_hdr); - ODP_ASSERT(odp_packet_has_ref(pkt) == 0); + _ODP_ASSERT(odp_packet_has_ref(pkt) == 0); if (len >= last_seg->seg_len) return NULL; @@ -980,7 +980,7 @@ int odp_packet_trunc_tail(odp_packet_t *pkt, uint32_t len, if (len >= pkt_hdr->frame_len) return -1; - ODP_ASSERT(odp_packet_has_ref(*pkt) == 0); + _ODP_ASSERT(odp_packet_has_ref(*pkt) == 0); last = pkt_hdr->seg_count - 1; last_seg = packet_last_seg(pkt_hdr); @@ -1143,7 +1143,7 @@ int odp_packet_align(odp_packet_t *pkt, uint32_t offset, uint32_t len, if (align > ODP_CACHE_LINE_SIZE) return -1; - ODP_ASSERT(odp_packet_has_ref(*pkt) == 0); + _ODP_ASSERT(odp_packet_has_ref(*pkt) == 0); if (seglen >= len) { misalign = align <= 1 ? 0 : @@ -1182,10 +1182,10 @@ int odp_packet_concat(odp_packet_t *dst, odp_packet_t src) uint32_t dst_len = dst_hdr->frame_len; uint32_t src_len = src_hdr->frame_len; - ODP_ASSERT(odp_packet_has_ref(*dst) == 0); + _ODP_ASSERT(odp_packet_has_ref(*dst) == 0); if (odp_unlikely(dst_len + src_len > dst_pool->max_len)) { - ODP_ERR("concat would result oversized packet\n"); + _ODP_ERR("concat would result oversized packet\n"); return -1; } @@ -1223,7 +1223,7 @@ int odp_packet_split(odp_packet_t *pkt, uint32_t len, odp_packet_t *tail) if (len >= pktlen || tail == NULL) return -1; - ODP_ASSERT(odp_packet_has_ref(*pkt) == 0); + _ODP_ASSERT(odp_packet_has_ref(*pkt) == 0); *tail = odp_packet_copy_part(*pkt, len, pktlen - len, odp_packet_pool(*pkt)); @@ -1250,7 +1250,7 @@ odp_packet_t odp_packet_copy(odp_packet_t pkt, odp_pool_t pool) md_copy = _odp_packet_copy_md_possible(pool, odp_packet_pool(pkt)); if (odp_unlikely(md_copy < 0)) { - ODP_ERR("Unable to copy packet metadata\n"); + _ODP_ERR("Unable to copy packet metadata\n"); return ODP_PACKET_INVALID; } @@ -1384,7 +1384,7 @@ int _odp_packet_cmp_data(odp_packet_t pkt, uint32_t offset, int ret; odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - ODP_ASSERT(offset + len <= pkt_hdr->frame_len); + _ODP_ASSERT(offset + len <= pkt_hdr->frame_len); while (len > 0) { mapaddr = packet_map(pkt_hdr, offset, &seglen, NULL); @@ -1509,7 +1509,7 @@ void odp_packet_print(odp_packet_t pkt) seg = odp_packet_next_seg(pkt, seg); } - ODP_PRINT("%s\n", str); + _ODP_PRINT("%s\n", str); } void odp_packet_print_data(odp_packet_t pkt, uint32_t offset, @@ -1544,7 +1544,7 @@ void odp_packet_print_data(odp_packet_t pkt, uint32_t offset, if (offset + byte_len > data_len) { len += snprintf(&str[len], n - len, " BAD OFFSET OR LEN\n"); - ODP_PRINT("%s\n", str); + _ODP_PRINT("%s\n", str); return; } @@ -1571,7 +1571,7 @@ void odp_packet_print_data(odp_packet_t pkt, uint32_t offset, offset += copy_len; } - ODP_PRINT("%s\n", str); + _ODP_PRINT("%s\n", str); } int odp_packet_is_valid(odp_packet_t pkt) @@ -1869,7 +1869,7 @@ int _odp_packet_l4_chksum(odp_packet_hdr_t *pkt_hdr, if (sum != 0) { pkt_hdr->p.flags.l4_chksum_err = 1; pkt_hdr->p.flags.udp_err = 1; - ODP_DBG("UDP chksum fail (%x)!\n", sum); + _ODP_DBG("UDP chksum fail (%x)!\n", sum); if (opt.bit.drop_udp_err) return -1; } @@ -1889,7 +1889,7 @@ int _odp_packet_l4_chksum(odp_packet_hdr_t *pkt_hdr, if (sum != 0) { pkt_hdr->p.flags.l4_chksum_err = 1; pkt_hdr->p.flags.tcp_err = 1; - ODP_DBG("TCP chksum fail (%x)!\n", sum); + _ODP_DBG("TCP chksum fail (%x)!\n", sum); if (opt.bit.drop_tcp_err) return -1; } @@ -1921,8 +1921,7 @@ int _odp_packet_l4_chksum(odp_packet_hdr_t *pkt_hdr, if (sum != sctp->chksum) { pkt_hdr->p.flags.l4_chksum_err = 1; pkt_hdr->p.flags.sctp_err = 1; - ODP_DBG("SCTP chksum fail (%x/%x)!\n", sum, - sctp->chksum); + _ODP_DBG("SCTP chksum fail (%x/%x)!\n", sum, sctp->chksum); if (opt.bit.drop_sctp_err) return -1; } @@ -2102,14 +2101,14 @@ odp_packet_t odp_packet_ref(odp_packet_t pkt, uint32_t offset) new = odp_packet_copy(pkt, odp_packet_pool(pkt)); if (new == ODP_PACKET_INVALID) { - ODP_ERR("copy failed\n"); + _ODP_ERR("copy failed\n"); return ODP_PACKET_INVALID; } ret = odp_packet_trunc_head(&new, offset, NULL, NULL); if (ret < 0) { - ODP_ERR("trunk_head failed\n"); + _ODP_ERR("trunk_head failed\n"); odp_packet_free(new); return ODP_PACKET_INVALID; } @@ -2126,14 +2125,14 @@ odp_packet_t odp_packet_ref_pkt(odp_packet_t pkt, uint32_t offset, ref = odp_packet_ref(pkt, offset); if (ref == ODP_PACKET_INVALID) { - ODP_DBG("reference create failed\n"); + _ODP_DBG("reference create failed\n"); return ODP_PACKET_INVALID; } ret = odp_packet_concat(&hdr, ref); if (ret < 0) { - ODP_DBG("concat failed\n"); + _ODP_DBG("concat failed\n"); odp_packet_free(ref); return ODP_PACKET_INVALID; } @@ -2227,7 +2226,7 @@ int odp_packet_has_tx_compl_request(odp_packet_t pkt) void odp_packet_tx_compl_free(odp_packet_tx_compl_t tx_compl) { if (odp_unlikely(tx_compl == ODP_PACKET_TX_COMPL_INVALID)) { - ODP_ERR("Bad TX completion event handle\n"); + _ODP_ERR("Bad TX completion event handle\n"); return; } @@ -2237,7 +2236,7 @@ void odp_packet_tx_compl_free(odp_packet_tx_compl_t tx_compl) void *odp_packet_tx_compl_user_ptr(odp_packet_tx_compl_t tx_compl) { if (odp_unlikely(tx_compl == ODP_PACKET_TX_COMPL_INVALID)) { - ODP_ERR("Bad TX completion event handle\n"); + _ODP_ERR("Bad TX completion event handle\n"); return NULL; } @@ -2279,17 +2278,17 @@ uint32_t odp_packet_disassemble(odp_packet_t pkt, odp_packet_buf_t pkt_buf[], ui uint32_t num_segs = odp_packet_num_segs(pkt); if (odp_unlikely(pool->type != ODP_POOL_PACKET)) { - ODP_ERR("Not a packet pool\n"); + _ODP_ERR("Not a packet pool\n"); return 0; } if (odp_unlikely(pool->pool_ext == 0)) { - ODP_ERR("Not an external memory pool\n"); + _ODP_ERR("Not an external memory pool\n"); return 0; } if (odp_unlikely(num < num_segs)) { - ODP_ERR("Not enough buffer handles %u. Packet has %u segments.\n", num, num_segs); + _ODP_ERR("Not enough buffer handles %u. Packet has %u segments.\n", num, num_segs); return 0; } @@ -2313,17 +2312,17 @@ odp_packet_t odp_packet_reassemble(odp_pool_t pool_hdl, odp_packet_buf_t pkt_buf pool_t *pool = _odp_pool_entry(pool_hdl); if (odp_unlikely(pool->type != ODP_POOL_PACKET)) { - ODP_ERR("Not a packet pool\n"); + _ODP_ERR("Not a packet pool\n"); return ODP_PACKET_INVALID; } if (odp_unlikely(pool->pool_ext == 0)) { - ODP_ERR("Not an external memory pool\n"); + _ODP_ERR("Not an external memory pool\n"); return ODP_PACKET_INVALID; } if (odp_unlikely(num == 0)) { - ODP_ERR("Bad number of buffers: %u\n", num); + _ODP_ERR("Bad number of buffers: %u\n", num); return ODP_PACKET_INVALID; } diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index c9f43ab9c..794452127 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -84,37 +84,37 @@ static int read_config_file(pktio_global_t *pktio_glb) const char *str; int val = 0; - ODP_PRINT("Packet IO config:\n"); + _ODP_PRINT("Packet IO config:\n"); str = "pktio.pktin_frame_offset"; if (!_odp_libconfig_lookup_int(str, &val)) { - ODP_ERR("Config option '%s' not found.\n", str); + _ODP_ERR("Config option '%s' not found.\n", str); return -1; } if (val < 0 || val > UINT16_MAX) { - ODP_ERR("Bad value %s = %i\n", str, val); + _ODP_ERR("Bad value %s = %i\n", str, val); return -1; } pktio_glb->config.pktin_frame_offset = val; - ODP_PRINT(" %s: %i\n", str, val); + _ODP_PRINT(" %s: %i\n", str, val); str = "pktio.tx_compl_pool_size"; if (!_odp_libconfig_lookup_int(str, &val)) { - ODP_ERR("Config option '%s' not found.\n", str); + _ODP_ERR("Config option '%s' not found.\n", str); return -1; } if (val < 0) { - ODP_ERR("Bad value %s = %i\n", str, val); + _ODP_ERR("Bad value %s = %i\n", str, val); return -1; } pktio_glb->config.tx_compl_pool_size = val; - ODP_PRINT(" %s: %i\n", str, val); + _ODP_PRINT(" %s: %i\n", str, val); - ODP_PRINT("\n"); + _ODP_PRINT("\n"); return 0; } @@ -158,15 +158,14 @@ int _odp_pktio_init_global(void) for (pktio_if = 0; _odp_pktio_if_ops[pktio_if]; ++pktio_if) { if (_odp_pktio_if_ops[pktio_if]->init_global) if (_odp_pktio_if_ops[pktio_if]->init_global()) { - ODP_ERR("failed to initialized pktio type %d", - pktio_if); + _ODP_ERR("failed to initialized pktio type %d", pktio_if); return -1; } } if (_ODP_PCAPNG) { if (_odp_pcapng_init_global()) { - ODP_ERR("Failed to initialize pcapng\n"); + _ODP_ERR("Failed to initialize pcapng\n"); return -1; } } @@ -181,8 +180,7 @@ int _odp_pktio_init_local(void) for (pktio_if = 0; _odp_pktio_if_ops[pktio_if]; ++pktio_if) { if (_odp_pktio_if_ops[pktio_if]->init_local) if (_odp_pktio_if_ops[pktio_if]->init_local()) { - ODP_ERR("failed to initialized pktio type %d", - pktio_if); + _ODP_ERR("failed to initialized pktio type %d", pktio_if); return -1; } } @@ -304,7 +302,7 @@ static odp_pktio_t setup_pktio_entry(const char *name, odp_pool_t pool, if (strlen(name) >= PKTIO_NAME_LEN - 1) { /* ioctl names limitation */ - ODP_ERR("pktio name %s is too long (max: %d chars)\n", name, PKTIO_NAME_LEN - 1); + _ODP_ERR("pktio name %s is too long (max: %d chars)\n", name, PKTIO_NAME_LEN - 1); return ODP_PKTIO_INVALID; } @@ -322,7 +320,7 @@ static odp_pktio_t setup_pktio_entry(const char *name, odp_pool_t pool, } if (i == ODP_CONFIG_PKTIO_ENTRIES) { - ODP_ERR("All pktios used already\n"); + _ODP_ERR("All pktios used already\n"); return ODP_PKTIO_INVALID; } @@ -355,7 +353,7 @@ static odp_pktio_t setup_pktio_entry(const char *name, odp_pool_t pool, if (ret != 0) { pktio_entry->state = PKTIO_STATE_FREE; unlock_entry(pktio_entry); - ODP_ERR("Unable to init any I/O type.\n"); + _ODP_ERR("Unable to init any I/O type.\n"); return ODP_PKTIO_INVALID; } @@ -385,7 +383,7 @@ static const char *driver_name(odp_pktio_t hdl) entry = get_pktio_entry(hdl); if (entry == NULL) { - ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); + _ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); return "bad handle"; } @@ -403,7 +401,7 @@ odp_pktio_t odp_pktio_open(const char *name, odp_pool_t pool, param = &default_param; } - ODP_ASSERT(pool_type_is_packet(pool)); + _ODP_ASSERT(pool_type_is_packet(pool)); hdl = odp_pktio_lookup(name); if (hdl != ODP_PKTIO_INVALID) { @@ -416,7 +414,7 @@ odp_pktio_t odp_pktio_open(const char *name, odp_pool_t pool, hdl = setup_pktio_entry(name, pool, param); odp_spinlock_unlock(&pktio_global->lock); - ODP_DBG("interface: %s, driver: %s\n", name, driver_name(hdl)); + _ODP_DBG("interface: %s, driver: %s\n", name, driver_name(hdl)); return hdl; } @@ -462,7 +460,7 @@ static void destroy_out_queues(pktio_entry_t *entry, int num) for (i = 0; i < num; i++) { if (entry->out_queue[i].queue != ODP_QUEUE_INVALID) { rc = odp_queue_destroy(entry->out_queue[i].queue); - ODP_ASSERT(rc == 0); + _ODP_ASSERT(rc == 0); entry->out_queue[i].queue = ODP_QUEUE_INVALID; } } @@ -486,7 +484,7 @@ static void flush_in_queues(pktio_entry_t *entry) while ((ret = odp_pktin_recv(pktin, packets, max_pkts))) { if (ret < 0) { - ODP_ERR("Queue flush failed\n"); + _ODP_ERR("Queue flush failed\n"); return; } @@ -503,12 +501,12 @@ int odp_pktio_close(odp_pktio_t hdl) entry = get_pktio_entry(hdl); if (entry == NULL) { - ODP_ERR("Bad handle\n"); + _ODP_ERR("Bad handle\n"); return -1; } if (entry->state == PKTIO_STATE_STARTED) { - ODP_DBG("Missing odp_pktio_stop() before close.\n"); + _ODP_DBG("Missing odp_pktio_stop() before close.\n"); return -1; } @@ -526,7 +524,7 @@ int odp_pktio_close(odp_pktio_t hdl) if (entry->tx_compl_pool != ODP_POOL_INVALID) { if (odp_pool_destroy(entry->tx_compl_pool)) { unlock_entry(entry); - ODP_ERR("Unable to destroy Tx event completion pool\n"); + _ODP_ERR("Unable to destroy Tx event completion pool\n"); return -1; } } @@ -535,11 +533,11 @@ int odp_pktio_close(odp_pktio_t hdl) res = _pktio_close(entry); odp_spinlock_unlock(&pktio_global->lock); if (res) - ODP_ABORT("unable to close pktio\n"); + _ODP_ABORT("unable to close pktio\n"); unlock_entry(entry); - ODP_DBG("interface: %s\n", entry->name); + _ODP_DBG("interface: %s\n", entry->name); return 0; } @@ -577,7 +575,7 @@ int odp_pktio_config(odp_pktio_t hdl, const odp_pktio_config_t *config) entry = get_pktio_entry(hdl); if (!entry) { - ODP_ERR("Bad handle\n"); + _ODP_ERR("Bad handle\n"); return -1; } @@ -591,23 +589,23 @@ int odp_pktio_config(odp_pktio_t hdl, const odp_pktio_config_t *config) /* Check config for invalid values */ if (config->pktin.all_bits & ~capa.config.pktin.all_bits) { - ODP_ERR("Unsupported input configuration option\n"); + _ODP_ERR("Unsupported input configuration option\n"); return -1; } if (config->pktout.all_bits & ~capa.config.pktout.all_bits) { - ODP_ERR("Unsupported output configuration option\n"); + _ODP_ERR("Unsupported output configuration option\n"); return -1; } if (config->enable_loop && !capa.config.enable_loop) { - ODP_ERR("Loopback mode not supported\n"); + _ODP_ERR("Loopback mode not supported\n"); return -1; } lock_entry(entry); if (entry->state == PKTIO_STATE_STARTED) { unlock_entry(entry); - ODP_DBG("pktio %s: not stopped\n", entry->name); + _ODP_DBG("pktio %s: not stopped\n", entry->name); return -1; } @@ -619,7 +617,7 @@ int odp_pktio_config(odp_pktio_t hdl, const odp_pktio_config_t *config) if (entry->enabled.tx_compl) if (configure_tx_event_compl(entry)) { unlock_entry(entry); - ODP_ERR("Unable to configure Tx event completion\n"); + _ODP_ERR("Unable to configure Tx event completion\n"); return -1; } @@ -641,14 +639,14 @@ int odp_pktio_start(odp_pktio_t hdl) entry = get_pktio_entry(hdl); if (!entry) { - ODP_ERR("Bad handle\n"); + _ODP_ERR("Bad handle\n"); return -1; } lock_entry(entry); if (entry->state == PKTIO_STATE_STARTED) { unlock_entry(entry); - ODP_ERR("Already started\n"); + _ODP_ERR("Already started\n"); return -1; } entry->parse_layer = pktio_cls_enabled(entry) ? @@ -674,7 +672,7 @@ int odp_pktio_start(odp_pktio_t hdl) odpq[i] = entry->in_queue[i].queue; if (entry->in_queue[i].queue == ODP_QUEUE_INVALID) { - ODP_ERR("No input queue\n"); + _ODP_ERR("No input queue\n"); return -1; } } @@ -682,12 +680,12 @@ int odp_pktio_start(odp_pktio_t hdl) _odp_sched_fn->pktio_start(odp_pktio_index(hdl), num, index, odpq); } - ODP_DBG("interface: %s, input queues: %u, output queues: %u\n", - entry->name, entry->num_in_queue, entry->num_out_queue); + _ODP_DBG("interface: %s, input queues: %u, output queues: %u\n", + entry->name, entry->num_in_queue, entry->num_out_queue); if (_ODP_PCAPNG) { if (_odp_pcapng_start(entry)) - ODP_ERR("pcapng start failed, won't capture\n"); + _ODP_ERR("pcapng start failed, won't capture\n"); } return res; @@ -699,7 +697,7 @@ static int _pktio_stop(pktio_entry_t *entry) odp_pktin_mode_t mode = entry->param.in_mode; if (entry->state != PKTIO_STATE_STARTED) { - ODP_ERR("Not started\n"); + _ODP_ERR("Not started\n"); return -1; } @@ -727,7 +725,7 @@ int odp_pktio_stop(odp_pktio_t hdl) entry = get_pktio_entry(hdl); if (!entry) { - ODP_ERR("Bad handle\n"); + _ODP_ERR("Bad handle\n"); return -1; } @@ -735,7 +733,7 @@ int odp_pktio_stop(odp_pktio_t hdl) res = _pktio_stop(entry); unlock_entry(entry); - ODP_DBG("interface: %s\n", entry->name); + _ODP_DBG("interface: %s\n", entry->name); return res; } @@ -999,7 +997,7 @@ static inline int packet_vector_send(odp_pktout_queue_t pktout_queue, odp_event_ int num, sent; num = odp_packet_vector_tbl(pktv, &pkt_tbl); - ODP_ASSERT(num > 0); + _ODP_ASSERT(num > 0); sent = odp_pktout_send(pktout_queue, pkt_tbl, num); /* Return success if any packets were sent. Free the possible remaining @@ -1010,7 +1008,7 @@ static inline int packet_vector_send(odp_pktout_queue_t pktout_queue, odp_event_ pktio_entry_t *entry = get_pktio_entry(pktout_queue.pktio); int discards = num - sent; - ODP_ASSERT(entry != NULL); + _ODP_ASSERT(entry != NULL); odp_atomic_add_u64(&entry->stats_extra.out_discards, discards); @@ -1102,7 +1100,7 @@ static _odp_event_hdr_t *pktin_dequeue(odp_queue_t queue) int pktin_index = pktin_queue.index; pktio_entry_t *entry = get_pktio_entry(pktio); - ODP_ASSERT(entry != NULL); + _ODP_ASSERT(entry != NULL); if (_odp_queue_fn->orig_deq_multi(queue, &event_hdr, 1) == 1) return event_hdr; @@ -1123,8 +1121,7 @@ static _odp_event_hdr_t *pktin_dequeue(odp_queue_t queue) if (odp_unlikely(num_enq < 0)) num_enq = 0; - ODP_DBG("Interface %s dropped %i packets\n", - entry->name, num - num_enq); + _ODP_DBG("Interface %s dropped %i packets\n", entry->name, num - num_enq); _odp_event_free_multi(&hdr_tbl[num_enq + 1], num - num_enq); } } @@ -1144,11 +1141,11 @@ static int pktin_deq_multi(odp_queue_t queue, _odp_event_hdr_t *event_hdr[], int pktin_index = pktin_queue.index; pktio_entry_t *entry = get_pktio_entry(pktio); - ODP_ASSERT(entry != NULL); + _ODP_ASSERT(entry != NULL); nbr = _odp_queue_fn->orig_deq_multi(queue, event_hdr, num); if (odp_unlikely(nbr > num)) - ODP_ABORT("queue_deq_multi req: %d, returned %d\n", num, nbr); + _ODP_ABORT("queue_deq_multi req: %d, returned %d\n", num, nbr); /** queue already has number of requested buffers, * do not do receive in that case. @@ -1177,8 +1174,8 @@ static int pktin_deq_multi(odp_queue_t queue, _odp_event_hdr_t *event_hdr[], if (odp_unlikely(num_enq < 0)) num_enq = 0; - ODP_DBG("Interface %s dropped %i packets\n", - entry->name, j - num_enq); + _ODP_DBG("Interface %s dropped %i packets\n", + entry->name, j - num_enq); _odp_event_free_multi(&event_hdr[num_enq], j - num_enq); } } @@ -1197,7 +1194,7 @@ int _odp_sched_cb_pktin_poll(int pktio_index, int pktin_index, state == PKTIO_STATE_STOP_PENDING) return -1; - ODP_DBG("Interface %s not started\n", entry->name); + _ODP_DBG("Interface %s not started\n", entry->name); return 0; } @@ -1216,7 +1213,7 @@ void _odp_sched_cb_pktio_stop_finalize(int pktio_index) if (state != PKTIO_STATE_STOP_PENDING && state != PKTIO_STATE_CLOSE_PENDING) { unlock_entry(entry); - ODP_ERR("Not in a pending state %i\n", state); + _ODP_ERR("Not in a pending state %i\n", state); return; } @@ -1235,7 +1232,7 @@ static inline uint32_t pktio_maxlen(odp_pktio_t hdl) entry = get_pktio_entry(hdl); if (entry == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); return 0; } @@ -1243,7 +1240,7 @@ static inline uint32_t pktio_maxlen(odp_pktio_t hdl) if (odp_unlikely(is_free(entry))) { unlock_entry(entry); - ODP_DBG("already freed pktio\n"); + _ODP_DBG("already freed pktio\n"); return 0; } @@ -1273,51 +1270,51 @@ int odp_pktio_maxlen_set(odp_pktio_t hdl, uint32_t maxlen_input, entry = get_pktio_entry(hdl); if (entry == NULL) { - ODP_ERR("Pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); + _ODP_ERR("Pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); return -1; } ret = odp_pktio_capability(hdl, &capa); if (ret) { - ODP_ERR("Reading pktio capability failed\n"); + _ODP_ERR("Reading pktio capability failed\n"); goto fail; } lock_entry(entry); if (odp_unlikely(is_free(entry))) { - ODP_ERR("Pktio already freed\n"); + _ODP_ERR("Pktio already freed\n"); ret = -1; goto fail; } if (entry->state == PKTIO_STATE_STARTED) { - ODP_ERR("Pktio not stopped\n"); + _ODP_ERR("Pktio not stopped\n"); ret = -1; goto fail; } if (capa.set_op.op.maxlen == 0) { - ODP_ERR("Setting maximum frame length not supported\n"); + _ODP_ERR("Setting maximum frame length not supported\n"); ret = -1; goto fail; } if (capa.maxlen.equal && (maxlen_input != maxlen_output)) { - ODP_ERR("Max input and output lengths don't match\n"); + _ODP_ERR("Max input and output lengths don't match\n"); ret = -1; goto fail; } if (maxlen_input < capa.maxlen.min_input || maxlen_input > capa.maxlen.max_input) { - ODP_ERR("Invalid max input length value: %" PRIu32 "\n", maxlen_input); + _ODP_ERR("Invalid max input length value: %" PRIu32 "\n", maxlen_input); ret = -1; goto fail; } if (maxlen_output < capa.maxlen.min_output || maxlen_output > capa.maxlen.max_output) { - ODP_ERR("Invalid max output length value: %" PRIu32 "\n", maxlen_output); + _ODP_ERR("Invalid max output length value: %" PRIu32 "\n", maxlen_output); ret = -1; goto fail; } @@ -1337,7 +1334,7 @@ int odp_pktio_promisc_mode_set(odp_pktio_t hdl, odp_bool_t enable) entry = get_pktio_entry(hdl); if (entry == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); return -1; } @@ -1345,7 +1342,7 @@ int odp_pktio_promisc_mode_set(odp_pktio_t hdl, odp_bool_t enable) if (odp_unlikely(is_free(entry))) { unlock_entry(entry); - ODP_DBG("already freed pktio\n"); + _ODP_DBG("already freed pktio\n"); return -1; } if (entry->state == PKTIO_STATE_STARTED) { @@ -1367,7 +1364,7 @@ int odp_pktio_promisc_mode(odp_pktio_t hdl) entry = get_pktio_entry(hdl); if (entry == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); return -1; } @@ -1375,7 +1372,7 @@ int odp_pktio_promisc_mode(odp_pktio_t hdl) if (odp_unlikely(is_free(entry))) { unlock_entry(entry); - ODP_DBG("already freed pktio\n"); + _ODP_DBG("already freed pktio\n"); return -1; } @@ -1398,7 +1395,7 @@ int odp_pktio_mac_addr(odp_pktio_t hdl, void *mac_addr, int addr_size) entry = get_pktio_entry(hdl); if (entry == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); return -1; } @@ -1406,14 +1403,14 @@ int odp_pktio_mac_addr(odp_pktio_t hdl, void *mac_addr, int addr_size) if (odp_unlikely(is_free(entry))) { unlock_entry(entry); - ODP_DBG("already freed pktio\n"); + _ODP_DBG("already freed pktio\n"); return -1; } if (entry->ops->mac_get) { ret = entry->ops->mac_get(entry, mac_addr); } else { - ODP_DBG("pktio does not support mac addr get\n"); + _ODP_DBG("pktio does not support mac addr get\n"); ret = -1; } unlock_entry(entry); @@ -1433,7 +1430,7 @@ int odp_pktio_mac_addr_set(odp_pktio_t hdl, const void *mac_addr, int addr_size) entry = get_pktio_entry(hdl); if (entry == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); return -1; } @@ -1441,7 +1438,7 @@ int odp_pktio_mac_addr_set(odp_pktio_t hdl, const void *mac_addr, int addr_size) if (odp_unlikely(is_free(entry))) { unlock_entry(entry); - ODP_DBG("already freed pktio\n"); + _ODP_DBG("already freed pktio\n"); return -1; } @@ -1464,7 +1461,7 @@ odp_pktio_link_status_t odp_pktio_link_status(odp_pktio_t hdl) entry = get_pktio_entry(hdl); if (entry == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); return ODP_PKTIO_LINK_STATUS_UNKNOWN; } @@ -1472,7 +1469,7 @@ odp_pktio_link_status_t odp_pktio_link_status(odp_pktio_t hdl) if (odp_unlikely(is_free(entry))) { unlock_entry(entry); - ODP_DBG("already freed pktio\n"); + _ODP_DBG("already freed pktio\n"); return ODP_PKTIO_LINK_STATUS_UNKNOWN; } @@ -1521,7 +1518,7 @@ int odp_pktio_info(odp_pktio_t hdl, odp_pktio_info_t *info) entry = get_pktio_entry(hdl); if (entry == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); return -1; } @@ -1541,7 +1538,7 @@ int odp_pktio_link_info(odp_pktio_t hdl, odp_pktio_link_info_t *info) entry = get_pktio_entry(hdl); if (entry == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); return -1; } @@ -1557,7 +1554,7 @@ uint64_t odp_pktio_ts_res(odp_pktio_t hdl) entry = get_pktio_entry(hdl); if (entry == NULL) { - ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); + _ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); return 0; } @@ -1574,7 +1571,7 @@ odp_time_t odp_pktio_ts_from_ns(odp_pktio_t hdl, uint64_t ns) entry = get_pktio_entry(hdl); if (entry == NULL) { - ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); + _ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); return ODP_TIME_NULL; } @@ -1591,7 +1588,7 @@ odp_time_t odp_pktio_time(odp_pktio_t hdl, odp_time_t *global_ts) entry = get_pktio_entry(hdl); if (entry == NULL) { - ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); + _ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); return ODP_TIME_NULL; } @@ -1630,7 +1627,7 @@ void odp_pktio_print(odp_pktio_t hdl) entry = get_pktio_entry(hdl); if (entry == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); return; } @@ -1679,12 +1676,12 @@ void odp_pktio_print(odp_pktio_t hdl) str[len] = '\0'; - ODP_PRINT("\n%s", str); + _ODP_PRINT("\n%s", str); if (entry->ops->print) entry->ops->print(entry); - ODP_PRINT("\n"); + _ODP_PRINT("\n"); } int _odp_pktio_term_global(void) @@ -1708,35 +1705,32 @@ int _odp_pktio_term_global(void) if (pktio_entry->state == PKTIO_STATE_STARTED) { ret = _pktio_stop(pktio_entry); if (ret) - ODP_ABORT("unable to stop pktio %s\n", - pktio_entry->name); + _ODP_ABORT("unable to stop pktio %s\n", pktio_entry->name); } if (pktio_entry->state != PKTIO_STATE_CLOSE_PENDING) ret = _pktio_close(pktio_entry); if (ret) - ODP_ABORT("unable to close pktio %s\n", - pktio_entry->name); + _ODP_ABORT("unable to close pktio %s\n", pktio_entry->name); unlock_entry(pktio_entry); } for (pktio_if = 0; _odp_pktio_if_ops[pktio_if]; ++pktio_if) { if (_odp_pktio_if_ops[pktio_if]->term) if (_odp_pktio_if_ops[pktio_if]->term()) - ODP_ABORT("failed to terminate pktio type %d", - pktio_if); + _ODP_ABORT("failed to terminate pktio type %d", pktio_if); } if (_ODP_PCAPNG) { ret = _odp_pcapng_term_global(); if (ret) - ODP_ERR("Failed to terminate pcapng\n"); + _ODP_ERR("Failed to terminate pcapng\n"); } shm = pktio_global->shm; ret = odp_shm_free(shm); if (ret != 0) - ODP_ERR("shm free failed\n"); + _ODP_ERR("shm free failed\n"); return ret; } @@ -1759,7 +1753,7 @@ int odp_pktio_capability(odp_pktio_t pktio, odp_pktio_capability_t *capa) entry = get_pktio_entry(pktio); if (entry == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); return -1; } @@ -1772,7 +1766,7 @@ int odp_pktio_capability(odp_pktio_t pktio, odp_pktio_capability_t *capa) uint32_t mtu = pktio_maxlen(pktio); if (mtu == 0) { - ODP_DBG("MTU query failed: %s\n", entry->name); + _ODP_DBG("MTU query failed: %s\n", entry->name); return -1; } @@ -1836,7 +1830,7 @@ int odp_pktio_stats(odp_pktio_t pktio, entry = get_pktio_entry(pktio); if (entry == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); return -1; } @@ -1844,7 +1838,7 @@ int odp_pktio_stats(odp_pktio_t pktio, if (odp_unlikely(is_free(entry))) { unlock_entry(entry); - ODP_DBG("already freed pktio\n"); + _ODP_DBG("already freed pktio\n"); return -1; } @@ -1867,7 +1861,7 @@ int odp_pktio_stats_reset(odp_pktio_t pktio) entry = get_pktio_entry(pktio); if (entry == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); return -1; } @@ -1875,7 +1869,7 @@ int odp_pktio_stats_reset(odp_pktio_t pktio) if (odp_unlikely(is_free(entry))) { unlock_entry(entry); - ODP_DBG("already freed pktio\n"); + _ODP_DBG("already freed pktio\n"); return -1; } @@ -1898,7 +1892,7 @@ int odp_pktin_queue_stats(odp_pktin_queue_t queue, entry = get_pktio_entry(queue.pktio); if (entry == NULL) { - ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)queue.pktio); + _ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)queue.pktio); return -1; } @@ -1906,14 +1900,14 @@ int odp_pktin_queue_stats(odp_pktin_queue_t queue, if (odp_unlikely(is_free(entry))) { unlock_entry(entry); - ODP_ERR("pktio entry already freed\n"); + _ODP_ERR("pktio entry already freed\n"); return -1; } mode = entry->param.in_mode; if (odp_unlikely(mode != ODP_PKTIN_MODE_DIRECT)) { unlock_entry(entry); - ODP_ERR("invalid packet input mode: %d\n", mode); + _ODP_ERR("invalid packet input mode: %d\n", mode); return -1; } @@ -1935,7 +1929,7 @@ int odp_pktin_event_queue_stats(odp_pktio_t pktio, odp_queue_t queue, entry = get_pktio_entry(pktio); if (entry == NULL) { - ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); + _ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); return -1; } @@ -1943,14 +1937,14 @@ int odp_pktin_event_queue_stats(odp_pktio_t pktio, odp_queue_t queue, if (odp_unlikely(is_free(entry))) { unlock_entry(entry); - ODP_ERR("pktio entry already freed\n"); + _ODP_ERR("pktio entry already freed\n"); return -1; } mode = entry->param.in_mode; if (odp_unlikely(mode != ODP_PKTIN_MODE_SCHED && mode != ODP_PKTIN_MODE_QUEUE)) { unlock_entry(entry); - ODP_ERR("invalid packet input mode: %d\n", mode); + _ODP_ERR("invalid packet input mode: %d\n", mode); return -1; } @@ -1973,7 +1967,7 @@ int odp_pktout_queue_stats(odp_pktout_queue_t queue, entry = get_pktio_entry(queue.pktio); if (entry == NULL) { - ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)queue.pktio); + _ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)queue.pktio); return -1; } @@ -1981,14 +1975,14 @@ int odp_pktout_queue_stats(odp_pktout_queue_t queue, if (odp_unlikely(is_free(entry))) { unlock_entry(entry); - ODP_ERR("pktio entry already freed\n"); + _ODP_ERR("pktio entry already freed\n"); return -1; } mode = entry->param.out_mode; if (odp_unlikely(mode != ODP_PKTOUT_MODE_DIRECT)) { unlock_entry(entry); - ODP_ERR("invalid packet output mode: %d\n", mode); + _ODP_ERR("invalid packet output mode: %d\n", mode); return -1; } @@ -2010,7 +2004,7 @@ int odp_pktout_event_queue_stats(odp_pktio_t pktio, odp_queue_t queue, entry = get_pktio_entry(pktio); if (entry == NULL) { - ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); + _ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); return -1; } @@ -2018,14 +2012,14 @@ int odp_pktout_event_queue_stats(odp_pktio_t pktio, odp_queue_t queue, if (odp_unlikely(is_free(entry))) { unlock_entry(entry); - ODP_ERR("pktio entry already freed\n"); + _ODP_ERR("pktio entry already freed\n"); return -1; } mode = entry->param.out_mode; if (odp_unlikely(mode != ODP_PKTOUT_MODE_QUEUE)) { unlock_entry(entry); - ODP_ERR("invalid packet output mode: %d\n", mode); + _ODP_ERR("invalid packet output mode: %d\n", mode); return -1; } @@ -2047,7 +2041,7 @@ int odp_pktio_extra_stat_info(odp_pktio_t pktio, entry = get_pktio_entry(pktio); if (entry == NULL) { - ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); + _ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); return -1; } @@ -2055,7 +2049,7 @@ int odp_pktio_extra_stat_info(odp_pktio_t pktio, if (odp_unlikely(is_free(entry))) { unlock_entry(entry); - ODP_ERR("already freed pktio\n"); + _ODP_ERR("already freed pktio\n"); return -1; } @@ -2074,7 +2068,7 @@ int odp_pktio_extra_stats(odp_pktio_t pktio, uint64_t stats[], int num) entry = get_pktio_entry(pktio); if (entry == NULL) { - ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); + _ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); return -1; } @@ -2082,7 +2076,7 @@ int odp_pktio_extra_stats(odp_pktio_t pktio, uint64_t stats[], int num) if (odp_unlikely(is_free(entry))) { unlock_entry(entry); - ODP_ERR("already freed pktio\n"); + _ODP_ERR("already freed pktio\n"); return -1; } @@ -2101,7 +2095,7 @@ int odp_pktio_extra_stat_counter(odp_pktio_t pktio, uint32_t id, uint64_t *stat) entry = get_pktio_entry(pktio); if (entry == NULL) { - ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); + _ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); return -1; } @@ -2109,7 +2103,7 @@ int odp_pktio_extra_stat_counter(odp_pktio_t pktio, uint32_t id, uint64_t *stat) if (odp_unlikely(is_free(entry))) { unlock_entry(entry); - ODP_ERR("already freed pktio\n"); + _ODP_ERR("already freed pktio\n"); return -1; } @@ -2134,7 +2128,7 @@ void odp_pktio_extra_stats_print(odp_pktio_t pktio) return; if (num_info != num_stats) { - ODP_ERR("extra statistics info counts not matching\n"); + _ODP_ERR("extra statistics info counts not matching\n"); return; } @@ -2150,14 +2144,14 @@ void odp_pktio_extra_stats_print(odp_pktio_t pktio) return; if (num_info != num_stats) { - ODP_ERR("extra statistics info counts not matching\n"); + _ODP_ERR("extra statistics info counts not matching\n"); return; } - ODP_PRINT("Pktio extra statistics\n----------------------\n"); + _ODP_PRINT("Pktio extra statistics\n----------------------\n"); for (i = 0; i < num_stats; i++) - ODP_PRINT(" %s=%" PRIu64 "\n", stats_info[i].name, extra_stats[i]); - ODP_PRINT("\n"); + _ODP_PRINT(" %s=%" PRIu64 "\n", stats_info[i].name, extra_stats[i]); + _ODP_PRINT("\n"); } int odp_pktin_queue_config(odp_pktio_t pktio, @@ -2178,12 +2172,12 @@ int odp_pktin_queue_config(odp_pktio_t pktio, entry = get_pktio_entry(pktio); if (entry == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); return -1; } if (entry->state == PKTIO_STATE_STARTED) { - ODP_DBG("pktio %s: not stopped\n", entry->name); + _ODP_DBG("pktio %s: not stopped\n", entry->name); return -1; } @@ -2194,7 +2188,7 @@ int odp_pktin_queue_config(odp_pktio_t pktio, return 0; if (!param->classifier_enable && param->num_queues == 0) { - ODP_DBG("invalid num_queues for operation mode\n"); + _ODP_DBG("invalid num_queues for operation mode\n"); return -1; } @@ -2202,15 +2196,14 @@ int odp_pktin_queue_config(odp_pktio_t pktio, rc = odp_pktio_capability(pktio, &capa); if (rc) { - ODP_DBG("pktio %s: unable to read capabilities\n", - entry->name); + _ODP_DBG("pktio %s: unable to read capabilities\n", entry->name); return -1; } entry->enabled.cls = !!param->classifier_enable; if (num_queues > capa.max_input_queues) { - ODP_DBG("pktio %s: too many input queues\n", entry->name); + _ODP_DBG("pktio %s: too many input queues\n", entry->name); return -1; } @@ -2220,35 +2213,35 @@ int odp_pktin_queue_config(odp_pktio_t pktio, odp_pool_info_t pool_info; if (mode == ODP_PKTIN_MODE_DIRECT) { - ODP_ERR("packet vectors not supported with ODP_PKTIN_MODE_DIRECT\n"); + _ODP_ERR("packet vectors not supported with ODP_PKTIN_MODE_DIRECT\n"); return -1; } if (param->vector.max_size < capa.vector.min_size) { - ODP_ERR("vector.max_size too small %" PRIu32 "\n", - param->vector.max_size); + _ODP_ERR("vector.max_size too small %" PRIu32 "\n", + param->vector.max_size); return -1; } if (param->vector.max_size > capa.vector.max_size) { - ODP_ERR("vector.max_size too large %" PRIu32 "\n", - param->vector.max_size); + _ODP_ERR("vector.max_size too large %" PRIu32 "\n", + param->vector.max_size); return -1; } if (param->vector.max_tmo_ns > capa.vector.max_tmo_ns) { - ODP_ERR("vector.max_tmo_ns too large %" PRIu64 "\n", - param->vector.max_tmo_ns); + _ODP_ERR("vector.max_tmo_ns too large %" PRIu64 "\n", + param->vector.max_tmo_ns); return -1; } if (pool == ODP_POOL_INVALID || odp_pool_info(pool, &pool_info)) { - ODP_ERR("invalid packet vector pool\n"); + _ODP_ERR("invalid packet vector pool\n"); return -1; } if (pool_info.params.type != ODP_POOL_VECTOR) { - ODP_ERR("wrong pool type\n"); + _ODP_ERR("wrong pool type\n"); return -1; } if (param->vector.max_size > pool_info.params.vector.max_size) { - ODP_ERR("vector.max_size larger than pool max vector size\n"); + _ODP_ERR("vector.max_size larger than pool max vector size\n"); return -1; } } @@ -2289,8 +2282,7 @@ int odp_pktin_queue_config(odp_pktio_t pktio, queue = odp_queue_create(name, &queue_param); if (queue == ODP_QUEUE_INVALID) { - ODP_DBG("pktio %s: event queue create failed\n", - entry->name); + _ODP_DBG("pktio %s: event queue create failed\n", entry->name); destroy_in_queues(entry, i + 1); return -1; } @@ -2337,7 +2329,7 @@ int _odp_pktio_pktout_tm_config(odp_pktio_t pktio_hdl, entry = get_pktio_entry(pktio_hdl); if (entry == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio_hdl); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio_hdl); return -1; } @@ -2357,7 +2349,7 @@ int _odp_pktio_pktout_tm_config(odp_pktio_t pktio_hdl, pktio_started = true; rc = odp_pktio_stop(pktio_hdl); if (rc) { - ODP_ERR("Unable to stop pktio, rc=%d\n", rc); + _ODP_ERR("Unable to stop pktio, rc=%d\n", rc); return rc; } } @@ -2380,7 +2372,7 @@ int _odp_pktio_pktout_tm_config(odp_pktio_t pktio_hdl, if (entry->ops->output_queues_config) { rc = entry->ops->output_queues_config(entry, ¶m); if (rc) - ODP_ERR("Unable to setup output queues, rc=%d\n", rc); + _ODP_ERR("Unable to setup output queues, rc=%d\n", rc); } /* Return pktout queue on success */ @@ -2410,12 +2402,12 @@ int odp_pktout_queue_config(odp_pktio_t pktio, entry = get_pktio_entry(pktio); if (entry == NULL) { - ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); + _ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); return -1; } if (entry->state == PKTIO_STATE_STARTED) { - ODP_ERR("pktio %s: not stopped\n", entry->name); + _ODP_ERR("pktio %s: not stopped\n", entry->name); return -1; } @@ -2427,26 +2419,25 @@ int odp_pktout_queue_config(odp_pktio_t pktio, return 0; if (mode != ODP_PKTOUT_MODE_DIRECT && mode != ODP_PKTOUT_MODE_QUEUE) { - ODP_ERR("pktio %s: bad packet output mode\n", entry->name); + _ODP_ERR("pktio %s: bad packet output mode\n", entry->name); return -1; } num_queues = param->num_queues; if (num_queues == 0) { - ODP_ERR("pktio %s: zero output queues\n", entry->name); + _ODP_ERR("pktio %s: zero output queues\n", entry->name); return -1; } rc = odp_pktio_capability(pktio, &capa); if (rc) { - ODP_ERR("pktio %s: unable to read capabilities\n", - entry->name); + _ODP_ERR("pktio %s: unable to read capabilities\n", entry->name); return -1; } if (num_queues > capa.max_output_queues) { - ODP_ERR("pktio %s: too many output queues\n", entry->name); + _ODP_ERR("pktio %s: too many output queues\n", entry->name); return -1; } @@ -2458,16 +2449,16 @@ int odp_pktout_queue_config(odp_pktio_t pktio, continue; if (capa.max_output_queue_size == 0) { - ODP_ERR("pktio %s: configuring output queue size not supported\n", - entry->name); + _ODP_ERR("pktio %s: configuring output queue size not supported\n", + entry->name); return -1; } if (queue_size < capa.min_output_queue_size) { - ODP_ERR("pktio %s: output queue size too small\n", entry->name); + _ODP_ERR("pktio %s: output queue size too small\n", entry->name); return -1; } if (queue_size > capa.max_output_queue_size) { - ODP_ERR("pktio %s: output queue size too large\n", entry->name); + _ODP_ERR("pktio %s: output queue size too large\n", entry->name); return -1; } } @@ -2504,8 +2495,7 @@ int odp_pktout_queue_config(odp_pktio_t pktio, queue = odp_queue_create(name, &queue_param); if (queue == ODP_QUEUE_INVALID) { - ODP_ERR("pktout %s: event queue create failed\n", - entry->name); + _ODP_ERR("pktout %s: event queue create failed\n", entry->name); destroy_out_queues(entry, i + 1); return -1; } @@ -2538,12 +2528,12 @@ int odp_pktin_event_queue(odp_pktio_t pktio, odp_queue_t queues[], int num) entry = get_pktio_entry(pktio); if (entry == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); return -1; } if (num < 0) { - ODP_DBG("Bad param: num %i\n", num); + _ODP_DBG("Bad param: num %i\n", num); return -1; } @@ -2578,12 +2568,12 @@ int odp_pktin_queue(odp_pktio_t pktio, odp_pktin_queue_t queues[], int num) entry = get_pktio_entry(pktio); if (entry == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); return -1; } if (num < 0) { - ODP_DBG("Bad param: num %i\n", num); + _ODP_DBG("Bad param: num %i\n", num); return -1; } @@ -2617,7 +2607,7 @@ int odp_pktout_event_queue(odp_pktio_t pktio, odp_queue_t queues[], int num) entry = get_pktio_entry(pktio); if (entry == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); return -1; } @@ -2648,7 +2638,7 @@ int odp_pktout_queue(odp_pktio_t pktio, odp_pktout_queue_t queues[], int num) entry = get_pktio_entry(pktio); if (entry == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); return -1; } @@ -2685,7 +2675,7 @@ int odp_pktin_recv(odp_pktin_queue_t queue, odp_packet_t packets[], int num) entry = get_pktio_entry(pktio); if (entry == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); return -1; } @@ -2714,7 +2704,7 @@ int odp_pktin_recv_tmo(odp_pktin_queue_t queue, odp_packet_t packets[], int num, entry = get_pktio_entry(queue.pktio); if (entry == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)queue.pktio); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)queue.pktio); return -1; } @@ -2882,7 +2872,7 @@ static void send_tx_compl_event(odp_buffer_t buf, const void *user_ptr, odp_queu _odp_event_type_set(ev, ODP_EVENT_PACKET_TX_COMPL); if (odp_unlikely(odp_queue_enq(queue, ev))) { - ODP_ERR("Failed to enqueue Tx completion event\n"); + _ODP_ERR("Failed to enqueue Tx completion event\n"); odp_event_free(ev); } } @@ -2912,7 +2902,7 @@ int odp_pktout_send(odp_pktout_queue_t queue, const odp_packet_t packets[], entry = get_pktio_entry(pktio); if (entry == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)pktio); return -1; } @@ -2961,7 +2951,7 @@ int odp_pktout_ts_read(odp_pktio_t hdl, odp_time_t *ts) entry = get_pktio_entry(hdl); if (odp_unlikely(entry == NULL)) { - ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); + _ODP_ERR("pktio entry %" PRIuPTR " does not exist\n", (uintptr_t)hdl); return -1; } @@ -2992,14 +2982,14 @@ odp_lso_profile_t odp_lso_profile_create(odp_pktio_t pktio, const odp_lso_profil /* Currently only IPv4 and custom implemented */ if (param->lso_proto != ODP_LSO_PROTO_IPV4 && param->lso_proto != ODP_LSO_PROTO_CUSTOM) { - ODP_ERR("Protocol not supported\n"); + _ODP_ERR("Protocol not supported\n"); return ODP_LSO_PROFILE_INVALID; } if (param->lso_proto == ODP_LSO_PROTO_CUSTOM) { num_custom = param->custom.num_custom; if (num_custom > ODP_LSO_MAX_CUSTOM) { - ODP_ERR("Too many custom fields\n"); + _ODP_ERR("Too many custom fields\n"); return ODP_LSO_PROFILE_INVALID; } @@ -3009,18 +2999,18 @@ odp_lso_profile_t odp_lso_profile_create(odp_pktio_t pktio, const odp_lso_profil size = param->custom.field[i].size; if (offset > PKTIO_LSO_MAX_PAYLOAD_OFFSET) { - ODP_ERR("Too large custom field offset %u\n", offset); + _ODP_ERR("Too large custom field offset %u\n", offset); return ODP_LSO_PROFILE_INVALID; } /* Currently only segment number supported */ if (mod_op != ODP_LSO_ADD_SEGMENT_NUM) { - ODP_ERR("Custom modify operation %u not supported\n", mod_op); + _ODP_ERR("Custom modify operation %u not supported\n", mod_op); return ODP_LSO_PROFILE_INVALID; } if (size != 1 && size != 2 && size != 4 && size != 8) { - ODP_ERR("Bad custom field size %u\n", size); + _ODP_ERR("Bad custom field size %u\n", size); return ODP_LSO_PROFILE_INVALID; } } @@ -3030,7 +3020,7 @@ odp_lso_profile_t odp_lso_profile_create(odp_pktio_t pktio, const odp_lso_profil if (pktio_global->num_lso_profiles >= PKTIO_LSO_PROFILES) { odp_spinlock_unlock(&pktio_global->lock); - ODP_ERR("All LSO profiles used already: %u\n", PKTIO_LSO_PROFILES); + _ODP_ERR("All LSO profiles used already: %u\n", PKTIO_LSO_PROFILES); return ODP_LSO_PROFILE_INVALID; } @@ -3046,7 +3036,7 @@ odp_lso_profile_t odp_lso_profile_create(odp_pktio_t pktio, const odp_lso_profil odp_spinlock_unlock(&pktio_global->lock); if (lso_prof == NULL) { - ODP_ERR("Did not find free LSO profile\n"); + _ODP_ERR("Did not find free LSO profile\n"); return ODP_LSO_PROFILE_INVALID; } @@ -3071,7 +3061,7 @@ int odp_lso_profile_destroy(odp_lso_profile_t lso_profile) lso_profile_t *lso_prof = lso_profile_ptr(lso_profile); if (lso_profile == ODP_LSO_PROFILE_INVALID || lso_prof->used == 0) { - ODP_ERR("Bad handle\n"); + _ODP_ERR("Bad handle\n"); return -1; } @@ -3090,22 +3080,22 @@ int odp_packet_lso_request(odp_packet_t pkt, const odp_packet_lso_opt_t *lso_opt uint32_t payload_offset = lso_opt->payload_offset; if (odp_unlikely(lso_opt->lso_profile == ODP_LSO_PROFILE_INVALID || lso_prof->used == 0)) { - ODP_ERR("Bad LSO profile handle\n"); + _ODP_ERR("Bad LSO profile handle\n"); return -1; } if (odp_unlikely(payload_offset > PKTIO_LSO_MAX_PAYLOAD_OFFSET)) { - ODP_ERR("Too large LSO payload offset\n"); + _ODP_ERR("Too large LSO payload offset\n"); return -1; } if (odp_unlikely(payload_offset > packet_len(pkt_hdr))) { - ODP_ERR("LSO payload offset larger than packet data length\n"); + _ODP_ERR("LSO payload offset larger than packet data length\n"); return -1; } if (odp_packet_payload_offset_set(pkt, payload_offset)) { - ODP_ERR("Payload offset set failed\n"); + _ODP_ERR("Payload offset set failed\n"); return -1; } @@ -3169,7 +3159,7 @@ static int lso_update_custom(lso_profile_t *lso_prof, odp_packet_t pkt, int segn ptr = &u8; if (odp_packet_copy_to_mem(pkt, offset, size, ptr)) { - ODP_ERR("Read from packet failed at offset %u\n", offset); + _ODP_ERR("Read from packet failed at offset %u\n", offset); return -1; } @@ -3185,7 +3175,7 @@ static int lso_update_custom(lso_profile_t *lso_prof, odp_packet_t pkt, int segn } if (odp_packet_copy_from_mem(pkt, offset, size, ptr)) { - ODP_ERR("Write to packet failed at offset %u\n", offset); + _ODP_ERR("Write to packet failed at offset %u\n", offset); return -1; } } @@ -3205,12 +3195,12 @@ int _odp_lso_num_packets(odp_packet_t packet, const odp_packet_lso_opt_t *lso_op uint32_t pkt_payload = pkt_len - hdr_len; if (odp_unlikely(hdr_len > PKTIO_LSO_MAX_PAYLOAD_OFFSET)) { - ODP_ERR("Too large LSO payload offset\n"); + _ODP_ERR("Too large LSO payload offset\n"); return -1; } if (odp_unlikely(hdr_len > pkt_len)) { - ODP_ERR("LSO payload offset larger than packet data length\n"); + _ODP_ERR("LSO payload offset larger than packet data length\n"); return -1; } @@ -3227,12 +3217,12 @@ int _odp_lso_num_packets(odp_packet_t packet, const odp_packet_lso_opt_t *lso_op iphdr_len = hdr_len - l3_offset; if (l3_offset == ODP_PACKET_OFFSET_INVALID) { - ODP_ERR("Invalid L3 offset\n"); + _ODP_ERR("Invalid L3 offset\n"); return -1; } if (hdr_len < l3_offset || iphdr_len < _ODP_IPV4HDR_LEN) { - ODP_ERR("Bad payload or L3 offset\n"); + _ODP_ERR("Bad payload or L3 offset\n"); return -1; } @@ -3247,8 +3237,8 @@ int _odp_lso_num_packets(odp_packet_t packet, const odp_packet_lso_opt_t *lso_op num_pkt++; if (num_pkt > PKTIO_LSO_MAX_SEGMENTS) { - ODP_ERR("Too many LSO segments %i. Maximum is %i\n", num_pkt, - PKTIO_LSO_MAX_SEGMENTS); + _ODP_ERR("Too many LSO segments %i. Maximum is %i\n", num_pkt, + PKTIO_LSO_MAX_SEGMENTS); return -1; } @@ -3278,7 +3268,7 @@ int _odp_lso_create_packets(odp_packet_t packet, const odp_packet_lso_opt_t *lso num = odp_packet_alloc_multi(pool, pkt_len, pkt_out, num_full); if (odp_unlikely(num < num_full)) { - ODP_DBG("Alloc failed %i\n", num); + _ODP_DBG("Alloc failed %i\n", num); if (num > 0) { num_free = num; goto error; @@ -3288,7 +3278,7 @@ int _odp_lso_create_packets(odp_packet_t packet, const odp_packet_lso_opt_t *lso if (left_over_len) { pkt = odp_packet_alloc(pool, hdr_len + left_over_len); if (pkt == ODP_PACKET_INVALID) { - ODP_DBG("Alloc failed\n"); + _ODP_DBG("Alloc failed\n"); num_free = num_full; goto error; } @@ -3301,7 +3291,7 @@ int _odp_lso_create_packets(odp_packet_t packet, const odp_packet_lso_opt_t *lso /* Copy headers */ for (i = 0; i < num_pkt; i++) { if (odp_packet_copy_from_pkt(pkt_out[i], 0, packet, 0, hdr_len)) { - ODP_ERR("Header copy failed\n"); + _ODP_ERR("Header copy failed\n"); goto error; } } @@ -3310,7 +3300,7 @@ int _odp_lso_create_packets(odp_packet_t packet, const odp_packet_lso_opt_t *lso for (i = 0; i < num_full; i++) { offset = hdr_len + (i * payload_len); if (odp_packet_copy_from_pkt(pkt_out[i], hdr_len, packet, offset, payload_len)) { - ODP_ERR("Payload copy failed\n"); + _ODP_ERR("Payload copy failed\n"); goto error; } } @@ -3320,7 +3310,7 @@ int _odp_lso_create_packets(odp_packet_t packet, const odp_packet_lso_opt_t *lso offset = hdr_len + (num_full * payload_len); if (odp_packet_copy_from_pkt(pkt_out[num_pkt - 1], hdr_len, packet, offset, left_over_len)){ - ODP_ERR("Payload copy failed\n"); + _ODP_ERR("Payload copy failed\n"); goto error; } } @@ -3329,13 +3319,13 @@ int _odp_lso_create_packets(odp_packet_t packet, const odp_packet_lso_opt_t *lso offset = odp_packet_l3_offset(packet); if (offset == ODP_PACKET_OFFSET_INVALID) { - ODP_ERR("Invalid L3 offset\n"); + _ODP_ERR("Invalid L3 offset\n"); goto error; } for (i = 0; i < num_pkt; i++) { if (lso_update_ipv4(pkt_out[i], i, num_pkt, offset, payload_len)) { - ODP_ERR("IPv4 header update failed. Packet %i.\n", i); + _ODP_ERR("IPv4 header update failed. Packet %i.\n", i); goto error; } } @@ -3345,7 +3335,7 @@ int _odp_lso_create_packets(odp_packet_t packet, const odp_packet_lso_opt_t *lso for (i = 0; num_custom && i < num_pkt; i++) { if (lso_update_custom(lso_prof, pkt_out[i], i)) { - ODP_ERR("Custom field update failed. Segment %i\n", i); + _ODP_ERR("Custom field update failed. Segment %i\n", i); goto error; } } @@ -3393,7 +3383,7 @@ static int pktout_send_lso(odp_pktout_queue_t queue, odp_packet_t packet, int first_free = 0; int num_free = num_pkt; - ODP_DBG("Packet send failed %i\n", ret); + _ODP_DBG("Packet send failed %i\n", ret); if (ret > 0) { first_free = ret; @@ -3419,7 +3409,7 @@ int odp_pktout_send_lso(odp_pktout_queue_t queue, const odp_packet_t packet[], i const odp_packet_lso_opt_t *opt_ptr = &lso_opt; if (odp_unlikely(num <= 0)) { - ODP_ERR("No packets\n"); + _ODP_ERR("No packets\n"); return -1; } @@ -3434,7 +3424,7 @@ int odp_pktout_send_lso(odp_pktout_queue_t queue, const odp_packet_t packet[], i odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); if (pkt_hdr->p.flags.lso == 0) { - ODP_ERR("No LSO options on packet %i\n", i); + _ODP_ERR("No LSO options on packet %i\n", i); if (i == 0) return -1; @@ -3447,7 +3437,7 @@ int odp_pktout_send_lso(odp_pktout_queue_t queue, const odp_packet_t packet[], i } if (odp_unlikely(pktout_send_lso(queue, pkt, opt_ptr))) { - ODP_DBG("LSO output failed on packet %i\n", i); + _ODP_DBG("LSO output failed on packet %i\n", i); return i; } } diff --git a/platform/linux-generic/odp_packet_vector.c b/platform/linux-generic/odp_packet_vector.c index b3edbf84b..354cec1d7 100644 --- a/platform/linux-generic/odp_packet_vector.c +++ b/platform/linux-generic/odp_packet_vector.c @@ -41,17 +41,17 @@ odp_packet_vector_t odp_packet_vector_alloc(odp_pool_t pool_hdl) odp_event_t event; pool_t *pool; - ODP_ASSERT(pool_hdl != ODP_POOL_INVALID); + _ODP_ASSERT(pool_hdl != ODP_POOL_INVALID); pool = _odp_pool_entry(pool_hdl); - ODP_ASSERT(pool->type == ODP_POOL_VECTOR); + _ODP_ASSERT(pool->type == ODP_POOL_VECTOR); event = _odp_event_alloc(pool); if (odp_unlikely(event == ODP_EVENT_INVALID)) return ODP_PACKET_VECTOR_INVALID; - ODP_ASSERT(event_vector_hdr_from_event(event)->size == 0); + _ODP_ASSERT(event_vector_hdr_from_event(event)->size == 0); return odp_packet_vector_from_event(event); } @@ -130,7 +130,7 @@ void odp_packet_vector_print(odp_packet_vector_t pktv) len += snprintf(&str[len], n - len, "%s", seg_str); } - ODP_PRINT("%s\n", str); + _ODP_PRINT("%s\n", str); } uint64_t odp_packet_vector_to_u64(odp_packet_vector_t pktv) diff --git a/platform/linux-generic/odp_pcapng.c b/platform/linux-generic/odp_pcapng.c index 1cc7bf5c8..d97e1ca9d 100644 --- a/platform/linux-generic/odp_pcapng.c +++ b/platform/linux-generic/odp_pcapng.c @@ -112,7 +112,7 @@ int _odp_pcapng_term_global(void) int ret = 0; if (odp_shm_free(pcapng_gbl->shm)) { - ODP_ERR("shm free failed"); + _ODP_ERR("shm free failed"); ret = -1; } @@ -139,8 +139,7 @@ static void inotify_event_handle(pktio_entry_t *entry, int qidx, if (PIPE_BUF < mtu + sizeof(pcapng_enhanced_packet_block_t) + sizeof(uint32_t)) { - ODP_ERR("PIPE_BUF:%d too small. Disabling pcap\n", - PIPE_BUF); + _ODP_ERR("PIPE_BUF:%d too small. Disabling pcap\n", PIPE_BUF); entry->pcapng.state[qidx] = PCAPNG_WR_STOP; return; @@ -151,16 +150,16 @@ static void inotify_event_handle(pktio_entry_t *entry, int qidx, entry->pcapng.state[qidx] = PCAPNG_WR_STOP; } else { entry->pcapng.state[qidx] = PCAPNG_WR_PKT; - ODP_DBG("Open %s for pcap tracing\n", event->name); + _ODP_DBG("Open %s for pcap tracing\n", event->name); } } else if (event->mask & IN_CLOSE) { int fd = entry->pcapng.fd[qidx]; pcapng_drain_fifo(fd); entry->pcapng.state[qidx] = PCAPNG_WR_STOP; - ODP_DBG("Close %s for pcap tracing\n", event->name); + _ODP_DBG("Close %s for pcap tracing\n", event->name); } else { - ODP_ERR("Unknown inotify event 0x%08x\n", event->mask); + _ODP_ERR("Unknown inotify event 0x%08x\n", event->mask); } } @@ -296,7 +295,7 @@ int _odp_pcapng_start(pktio_entry_t *entry) fifo_sz = get_fifo_max_size(); if (fifo_sz < 0) - ODP_DBG("failed to read max fifo size\n"); + _ODP_DBG("failed to read max fifo size\n"); for (i = 0; i < max_queue; i++) { char pcapng_name[128]; @@ -310,29 +309,28 @@ int _odp_pcapng_start(pktio_entry_t *entry) snprintf(pcapng_path, sizeof(pcapng_path), "%s/%s", PCAPNG_WATCH_DIR, pcapng_name); if (mkfifo(pcapng_path, O_RDWR)) { - ODP_ERR("pcap not available for %s %s\n", - pcapng_path, strerror(errno)); + _ODP_ERR("pcap not available for %s %s\n", pcapng_path, strerror(errno)); continue; } if (chmod(pcapng_path, S_IRUSR | S_IRGRP)) - ODP_ERR("Failed to change file permission for %s %s\n", - pcapng_path, strerror(errno)); + _ODP_ERR("Failed to change file permission for %s %s\n", + pcapng_path, strerror(errno)); fd = open(pcapng_path, O_RDWR | O_NONBLOCK); if (fd == -1) { - ODP_ERR("Fail to open fifo\n"); + _ODP_ERR("Fail to open fifo\n"); entry->pcapng.state[i] = PCAPNG_WR_STOP; if (remove(pcapng_path) == -1) - ODP_ERR("Can't remove fifo %s\n", pcapng_path); + _ODP_ERR("Can't remove fifo %s\n", pcapng_path); continue; } if (fifo_sz > 0) { if (fcntl(fd, F_SETPIPE_SZ, fifo_sz) != fifo_sz) - ODP_DBG("Failed to set max fifo size\n"); + _ODP_DBG("Failed to set max fifo size\n"); else - ODP_DBG("set pcap fifo size %i\n", fifo_sz); + _ODP_DBG("set pcap fifo size %i\n", fifo_sz); } entry->pcapng.fd[i] = fd; @@ -353,7 +351,7 @@ int _odp_pcapng_start(pktio_entry_t *entry) pcapng_gbl->inotify_fd = inotify_init(); if (pcapng_gbl->inotify_fd == -1) { - ODP_ERR("can't init inotify. pcap disabled\n"); + _ODP_ERR("can't init inotify. pcap disabled\n"); goto out_destroy; } @@ -362,8 +360,7 @@ int _odp_pcapng_start(pktio_entry_t *entry) IN_CLOSE | IN_OPEN); if (pcapng_gbl->inotify_watch_fd == -1) { - ODP_ERR("can't register inotify for %s. pcap disabled\n", - strerror(errno)); + _ODP_ERR("can't register inotify for %s. pcap disabled\n", strerror(errno)); goto out_destroy; } @@ -372,7 +369,7 @@ int _odp_pcapng_start(pktio_entry_t *entry) ret = pthread_create(&pcapng_gbl->inotify_thread, &attr, inotify_update, &pcapng_gbl->inotify_fd); if (ret) { - ODP_ERR("Can't start inotify thread (ret=%d). pcapng disabled.\n", ret); + _ODP_ERR("Can't start inotify thread (ret=%d). pcapng disabled.\n", ret); } else { pcapng_gbl->entry[odp_pktio_index(entry->handle)] = entry; pcapng_gbl->num_entries++; @@ -406,8 +403,7 @@ void _odp_pcapng_stop(pktio_entry_t *entry) pcapng_gbl->num_entries == 0) { ret = pthread_cancel(pcapng_gbl->inotify_thread); if (ret) - ODP_ERR("can't cancel inotify thread %s\n", - strerror(errno)); + _ODP_ERR("can't cancel inotify thread %s\n", strerror(errno)); pcapng_gbl->inotify_is_running = 0; } @@ -416,8 +412,7 @@ void _odp_pcapng_stop(pktio_entry_t *entry) ret = inotify_rm_watch(pcapng_gbl->inotify_fd, pcapng_gbl->inotify_watch_fd); if (ret) - ODP_ERR("can't deregister inotify %s\n", - strerror(errno)); + _ODP_ERR("can't deregister inotify %s\n", strerror(errno)); if (pcapng_gbl->inotify_fd != -1) close(pcapng_gbl->inotify_fd); @@ -441,7 +436,7 @@ void _odp_pcapng_stop(pktio_entry_t *entry) PCAPNG_WATCH_DIR, pcapng_name); if (remove(pcapng_path)) - ODP_ERR("can't delete fifo %s\n", pcapng_path); + _ODP_ERR("can't delete fifo %s\n", pcapng_path); } } @@ -466,7 +461,7 @@ int write_pcapng_hdr(pktio_entry_t *entry, int qidx) len = write(fd, &shb, sizeof(shb)); /* fail to write shb/idb means the pcapng is unreadable */ if (len != sizeof(shb)) { - ODP_ERR("Failed to write pcapng section hdr\n"); + _ODP_ERR("Failed to write pcapng section hdr\n"); return -1; } fsync(fd); @@ -478,7 +473,7 @@ int write_pcapng_hdr(pktio_entry_t *entry, int qidx) idb.snaplen = 0x0; /* unlimited */ len = write(fd, &idb, sizeof(idb)); if (len != sizeof(idb)) { - ODP_ERR("Failed to write pcapng interface description\n"); + _ODP_ERR("Failed to write pcapng interface description\n"); return -1; } fsync(fd); diff --git a/platform/linux-generic/odp_pkt_queue.c b/platform/linux-generic/odp_pkt_queue.c index e977efc24..3f2fb6e0b 100644 --- a/platform/linux-generic/odp_pkt_queue.c +++ b/platform/linux-generic/odp_pkt_queue.c @@ -280,7 +280,7 @@ void _odp_pkt_queue_destroy(_odp_int_queue_pool_t queue_pool, uint32_t queue_num = (uint32_t)pkt_queue; if ((queue_num == 0) || (queue_num > pool->max_queue_num)) { - ODP_ERR("Invalid TM packet queue ID\n"); + _ODP_ERR("Invalid TM packet queue ID\n"); return; } @@ -406,17 +406,17 @@ void _odp_pkt_queue_stats_print(_odp_int_queue_pool_t queue_pool) queue_pool_t *pool; pool = (queue_pool_t *)(uintptr_t)queue_pool; - ODP_PRINT("pkt_queue_stats - queue_pool=0x%" PRIX64 "\n", queue_pool); - ODP_PRINT(" max_queue_num=%" PRIu32 " max_queued_pkts=%" PRIu32 " " - "num_queues=%" PRIu32 "\n", pool->max_queue_num, - pool->max_queued_pkts, pool->num_queues); - ODP_PRINT(" total pkt appends=%" PRIu64 " total pkt removes=%" PRIu64 - " bad removes=%" PRIu64 "\n", - pool->total_pkt_appends, pool->total_pkt_removes, - pool->total_bad_removes); - ODP_PRINT(" free_list size=%u min size=%u peak size=%u\n", - pool->free_list_size, pool->min_free_list_size, - pool->peak_free_list_size); + _ODP_PRINT("pkt_queue_stats - queue_pool=0x%" PRIX64 "\n", queue_pool); + _ODP_PRINT(" max_queue_num=%" PRIu32 " max_queued_pkts=%" PRIu32 " " + "num_queues=%" PRIu32 "\n", pool->max_queue_num, + pool->max_queued_pkts, pool->num_queues); + _ODP_PRINT(" total pkt appends=%" PRIu64 " total pkt removes=%" PRIu64 + " bad removes=%" PRIu64 "\n", + pool->total_pkt_appends, pool->total_pkt_removes, + pool->total_bad_removes); + _ODP_PRINT(" free_list size=%u min size=%u peak size=%u\n", + pool->free_list_size, pool->min_free_list_size, + pool->peak_free_list_size); } void _odp_queue_pool_destroy(_odp_int_queue_pool_t queue_pool) diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index a92cc615d..e73943ebd 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -145,13 +145,13 @@ static inline int cache_available(pool_t *pool, odp_pool_stats_t *stats) if (per_thread) { if (first > last || last >= odp_thread_count_max()) { - ODP_ERR("Bad thread ids: first=%" PRIu16 " last=%" PRIu16 "\n", - first, last); + _ODP_ERR("Bad thread ids: first=%" PRIu16 " last=%" PRIu16 "\n", + first, last); return -1; } if (last - first + 1 > ODP_POOL_MAX_THREAD_STATS) { - ODP_ERR("Too many thread ids: max=%d\n", ODP_POOL_MAX_THREAD_STATS); + _ODP_ERR("Too many thread ids: max=%d\n", ODP_POOL_MAX_THREAD_STATS); return -1; } } @@ -177,81 +177,80 @@ static int read_config_file(pool_global_t *pool_glb) const char *str; int val = 0; - ODP_PRINT("Pool config:\n"); + _ODP_PRINT("Pool config:\n"); str = "pool.local_cache_size"; if (!_odp_libconfig_lookup_int(str, &val)) { - ODP_ERR("Config option '%s' not found.\n", str); + _ODP_ERR("Config option '%s' not found.\n", str); return -1; } if (val > CONFIG_POOL_CACHE_MAX_SIZE || val < 0) { - ODP_ERR("Bad value %s = %i, max %i\n", str, val, - CONFIG_POOL_CACHE_MAX_SIZE); + _ODP_ERR("Bad value %s = %i, max %i\n", str, val, CONFIG_POOL_CACHE_MAX_SIZE); return -1; } local_cache_size = val; pool_glb->config.local_cache_size = local_cache_size; - ODP_PRINT(" %s: %i\n", str, val); + _ODP_PRINT(" %s: %i\n", str, val); str = "pool.burst_size"; if (!_odp_libconfig_lookup_int(str, &val)) { - ODP_ERR("Config option '%s' not found.\n", str); + _ODP_ERR("Config option '%s' not found.\n", str); return -1; } if (val <= 0) { - ODP_ERR("Bad value %s = %i\n", str, val); + _ODP_ERR("Bad value %s = %i\n", str, val); return -1; } burst_size = val; pool_glb->config.burst_size = burst_size; - ODP_PRINT(" %s: %i\n", str, val); + _ODP_PRINT(" %s: %i\n", str, val); /* Check local cache size and burst size relation */ if (local_cache_size % burst_size) { - ODP_ERR("Pool cache size not multiple of burst size\n"); + _ODP_ERR("Pool cache size not multiple of burst size\n"); return -1; } if (local_cache_size && (local_cache_size / burst_size < 2)) { - ODP_ERR("Cache burst size too large compared to cache size\n"); + _ODP_ERR("Cache burst size too large compared to cache size\n"); return -1; } str = "pool.pkt.max_num"; if (!_odp_libconfig_lookup_int(str, &val)) { - ODP_ERR("Config option '%s' not found.\n", str); + _ODP_ERR("Config option '%s' not found.\n", str); return -1; } if (val > CONFIG_POOL_MAX_NUM || val < POOL_MAX_NUM_MIN) { - ODP_ERR("Bad value %s = %i\n", str, val); + _ODP_ERR("Bad value %s = %i\n", str, val); return -1; } pool_glb->config.pkt_max_num = val; - ODP_PRINT(" %s: %i\n", str, val); + _ODP_PRINT(" %s: %i\n", str, val); str = "pool.pkt.max_len"; if (!_odp_libconfig_lookup_int(str, &val)) { - ODP_ERR("Config option '%s' not found.\n", str); + _ODP_ERR("Config option '%s' not found.\n", str); return -1; } if (val <= 0) { - ODP_ERR("Bad value %s = %i\n", str, val); + _ODP_ERR("Bad value %s = %i\n", str, val); return -1; } pool_glb->config.pkt_max_len = val; - ODP_PRINT(" %s: %i\n", str, val); + _ODP_PRINT(" %s: %i\n", str, val); str = "pool.pkt.base_align"; if (!_odp_libconfig_lookup_int(str, &val)) { - ODP_ERR("Config option '%s' not found.\n", str); + _ODP_ERR("Config option '%s' not found.\n", str); return -1; } @@ -260,16 +259,16 @@ static int read_config_file(pool_global_t *pool_glb) align = ODP_CACHE_LINE_SIZE; if (!_ODP_CHECK_IS_POWER2(align)) { - ODP_ERR("Not a power of two: %s = %i\n", str, val); + _ODP_ERR("Not a power of two: %s = %i\n", str, val); return -1; } pool_glb->config.pkt_base_align = align; - ODP_PRINT(" %s: %u\n", str, align); + _ODP_PRINT(" %s: %u\n", str, align); str = "pool.buf.min_align"; if (!_odp_libconfig_lookup_int(str, &val)) { - ODP_ERR("Config option '%s' not found.\n", str); + _ODP_ERR("Config option '%s' not found.\n", str); return -1; } @@ -278,14 +277,14 @@ static int read_config_file(pool_global_t *pool_glb) align = ODP_CACHE_LINE_SIZE; if (!_ODP_CHECK_IS_POWER2(align)) { - ODP_ERR("Not a power of two: %s = %i\n", str, val); + _ODP_ERR("Not a power of two: %s = %i\n", str, val); return -1; } pool_glb->config.buf_min_align = align; - ODP_PRINT(" %s: %u\n", str, align); + _ODP_PRINT(" %s: %u\n", str, align); - ODP_PRINT("\n"); + _ODP_PRINT("\n"); return 0; } @@ -321,15 +320,15 @@ int _odp_pool_init_global(void) pool->pool_idx = i; } - ODP_DBG("\nPool init global\n"); - ODP_DBG(" event_hdr_t size %zu\n", sizeof(_odp_event_hdr_t)); - ODP_DBG(" buffer_hdr_t size %zu\n", sizeof(odp_buffer_hdr_t)); - ODP_DBG(" packet_hdr_t size %zu\n", sizeof(odp_packet_hdr_t)); - ODP_DBG(" timeout_hdr_t size %zu\n", sizeof(odp_timeout_hdr_t)); - ODP_DBG(" event_vector_hdr_t size %zu\n", sizeof(odp_event_vector_hdr_t)); - ODP_DBG(" packet_hdr_t::seg_data offset %zu\n", offsetof(odp_packet_hdr_t, seg_data)); - ODP_DBG(" packet_hdr_t::timestamp offset %zu\n", offsetof(odp_packet_hdr_t, timestamp)); - ODP_DBG("\n"); + _ODP_DBG("\nPool init global\n"); + _ODP_DBG(" event_hdr_t size %zu\n", sizeof(_odp_event_hdr_t)); + _ODP_DBG(" buffer_hdr_t size %zu\n", sizeof(odp_buffer_hdr_t)); + _ODP_DBG(" packet_hdr_t size %zu\n", sizeof(odp_packet_hdr_t)); + _ODP_DBG(" timeout_hdr_t size %zu\n", sizeof(odp_timeout_hdr_t)); + _ODP_DBG(" event_vector_hdr_t size %zu\n", sizeof(odp_event_vector_hdr_t)); + _ODP_DBG(" packet_hdr_t::seg_data offset %zu\n", offsetof(odp_packet_hdr_t, seg_data)); + _ODP_DBG(" packet_hdr_t::timestamp offset %zu\n", offsetof(odp_packet_hdr_t, timestamp)); + _ODP_DBG("\n"); return 0; } @@ -348,7 +347,7 @@ int _odp_pool_term_global(void) LOCK(&pool->lock); if (pool->reserved) { - ODP_ERR("Not destroyed pool: %s\n", pool->name); + _ODP_ERR("Not destroyed pool: %s\n", pool->name); rc = -1; } UNLOCK(&pool->lock); @@ -356,7 +355,7 @@ int _odp_pool_term_global(void) ret = odp_shm_free(_odp_pool_glb->shm); if (ret < 0) { - ODP_ERR("SHM free failed\n"); + _ODP_ERR("SHM free failed\n"); rc = -1; } @@ -422,7 +421,7 @@ static pool_t *reserve_pool(uint32_t shmflags, uint8_t pool_ext, uint32_t num) shm = odp_shm_reserve(ring_name, mem_size, ODP_CACHE_LINE_SIZE, shmflags); if (odp_unlikely(shm == ODP_SHM_INVALID)) { - ODP_ERR("Unable to alloc pool ring %d\n", i); + _ODP_ERR("Unable to alloc pool ring %d\n", i); LOCK(&pool->lock); pool->reserved = 0; UNLOCK(&pool->lock); @@ -529,7 +528,7 @@ static void init_buffers(pool_t *pool) int skipped_blocks = 0; if (odp_shm_info(pool->shm, &shm_info)) - ODP_ABORT("Shm info failed\n"); + _ODP_ABORT("Shm info failed\n"); page_size = shm_info.page_size; ring = &pool->ring->hdr; @@ -600,7 +599,7 @@ static bool shm_is_from_huge_pages(odp_shm_t shm) return 0; if (odp_shm_info(shm, &info)) { - ODP_ERR("Failed to fetch shm info\n"); + _ODP_ERR("Failed to fetch shm info\n"); return 0; } @@ -679,8 +678,8 @@ static void set_mem_src_ops(pool_t *pool) if (_odp_pool_mem_src_ops[i]->is_active()) { is_active_found = true; pool->mem_src_ops = _odp_pool_mem_src_ops[i]; - ODP_DBG("Packet pool as a memory source for: %s\n", - pool->mem_src_ops->name); + _ODP_DBG("Packet pool as a memory source for: %s\n", + pool->mem_src_ops->name); } } else if (_odp_pool_mem_src_ops[i]->is_active()) { _odp_pool_mem_src_ops[i]->force_disable(); @@ -719,7 +718,7 @@ odp_pool_t _odp_pool_create(const char *name, const odp_pool_param_t *params, if (align_req && (!_ODP_CHECK_IS_POWER2(align_req) || align_req > _odp_pool_glb->config.pkt_base_align)) { - ODP_ERR("Bad align requirement\n"); + _ODP_ERR("Bad align requirement\n"); return ODP_POOL_INVALID; } @@ -735,7 +734,7 @@ odp_pool_t _odp_pool_create(const char *name, const odp_pool_param_t *params, /* Validate requested buffer alignment */ if (align > ODP_CONFIG_BUFFER_ALIGN_MAX || align != _ODP_ROUNDDOWN_POWER2(align, align)) { - ODP_ERR("Bad align requirement\n"); + _ODP_ERR("Bad align requirement\n"); return ODP_POOL_INVALID; } @@ -756,7 +755,7 @@ odp_pool_t _odp_pool_create(const char *name, const odp_pool_param_t *params, case ODP_POOL_PACKET: if (params->pkt.headroom > CONFIG_PACKET_HEADROOM) { - ODP_ERR("Packet headroom size not supported\n"); + _ODP_ERR("Packet headroom size not supported\n"); return ODP_POOL_INVALID; } @@ -779,7 +778,7 @@ odp_pool_t _odp_pool_create(const char *name, const odp_pool_param_t *params, if ((max_len + seg_len - 1) / seg_len > PKT_MAX_SEGS) seg_len = (max_len + PKT_MAX_SEGS - 1) / PKT_MAX_SEGS; if (seg_len > CONFIG_PACKET_MAX_SEG_LEN) { - ODP_ERR("Pool unable to store 'max_len' packet\n"); + _ODP_ERR("Pool unable to store 'max_len' packet\n"); return ODP_POOL_INVALID; } @@ -789,8 +788,8 @@ odp_pool_t _odp_pool_create(const char *name, const odp_pool_param_t *params, /* Make sure 'params->pkt.max_num' limitation holds */ if (params->pkt.max_num && num > params->pkt.max_num) { - ODP_ERR("Pool 'max_num' parameter too small (%u/%u)\n", - params->pkt.max_num, num); + _ODP_ERR("Pool 'max_num' parameter too small (%u/%u)\n", + params->pkt.max_num, num); return ODP_POOL_INVALID; } @@ -814,14 +813,14 @@ odp_pool_t _odp_pool_create(const char *name, const odp_pool_param_t *params, break; default: - ODP_ERR("Bad pool type\n"); + _ODP_ERR("Bad pool type\n"); return ODP_POOL_INVALID; } pool = reserve_pool(shmflags, 0, num); if (pool == NULL) { - ODP_ERR("No more free pools\n"); + _ODP_ERR("No more free pools\n"); return ODP_POOL_INVALID; } @@ -848,7 +847,7 @@ odp_pool_t _odp_pool_create(const char *name, const odp_pool_param_t *params, &pool->block_offset, &shmflags); if (!adj_size) { - ODP_ERR("Calculating adjusted block size failed\n"); + _ODP_ERR("Calculating adjusted block size failed\n"); return ODP_POOL_INVALID; } } @@ -908,7 +907,7 @@ odp_pool_t _odp_pool_create(const char *name, const odp_pool_param_t *params, pool->shm = shm; if (shm == ODP_SHM_INVALID) { - ODP_ERR("SHM reserve failed\n"); + _ODP_ERR("SHM reserve failed\n"); goto error; } @@ -918,7 +917,7 @@ odp_pool_t _odp_pool_create(const char *name, const odp_pool_param_t *params, pool->max_addr = pool->base_addr + pool->shm_size - 1; if (reserve_uarea(pool, uarea_size, num, shmflags)) { - ODP_ERR("User area SHM reserve failed\n"); + _ODP_ERR("User area SHM reserve failed\n"); goto error; } @@ -927,7 +926,7 @@ odp_pool_t _odp_pool_create(const char *name, const odp_pool_param_t *params, if (type == ODP_POOL_PACKET && pool->mem_src_ops && pool->mem_src_ops->bind && pool->mem_src_ops->bind(pool->mem_src_data, pool)) { - ODP_ERR("Binding pool as memory source failed\n"); + _ODP_ERR("Binding pool as memory source failed\n"); goto error; } @@ -981,27 +980,27 @@ static int check_params(const odp_pool_param_t *params) cache_size = params->buf.cache_size; if (params->buf.num > capa.buf.max_num) { - ODP_ERR("buf.num too large %u\n", params->buf.num); + _ODP_ERR("buf.num too large %u\n", params->buf.num); return -1; } if (params->buf.size > capa.buf.max_size) { - ODP_ERR("buf.size too large %u\n", params->buf.size); + _ODP_ERR("buf.size too large %u\n", params->buf.size); return -1; } if (params->buf.align > capa.buf.max_align) { - ODP_ERR("buf.align too large %u\n", params->buf.align); + _ODP_ERR("buf.align too large %u\n", params->buf.align); return -1; } if (params->buf.uarea_size > capa.buf.max_uarea_size) { - ODP_ERR("buf.uarea_size too large %u\n", params->buf.uarea_size); + _ODP_ERR("buf.uarea_size too large %u\n", params->buf.uarea_size); return -1; } if (params->stats.all & ~capa.buf.stats.all) { - ODP_ERR("Unsupported pool statistics counter\n"); + _ODP_ERR("Unsupported pool statistics counter\n"); return -1; } @@ -1012,47 +1011,42 @@ static int check_params(const odp_pool_param_t *params) cache_size = params->pkt.cache_size; if (params->pkt.num > capa.pkt.max_num) { - ODP_ERR("pkt.num too large %u\n", params->pkt.num); + _ODP_ERR("pkt.num too large %u\n", params->pkt.num); return -1; } if (params->pkt.max_num > capa.pkt.max_num) { - ODP_ERR("pkt.max_num too large %u\n", - params->pkt.max_num); + _ODP_ERR("pkt.max_num too large %u\n", params->pkt.max_num); return -1; } if (params->pkt.len > capa.pkt.max_len) { - ODP_ERR("pkt.len too large %u\n", params->pkt.len); + _ODP_ERR("pkt.len too large %u\n", params->pkt.len); return -1; } if (params->pkt.max_len > capa.pkt.max_len) { - ODP_ERR("pkt.max_len too large %u\n", - params->pkt.max_len); + _ODP_ERR("pkt.max_len too large %u\n", params->pkt.max_len); return -1; } if (params->pkt.seg_len > capa.pkt.max_seg_len) { - ODP_ERR("pkt.seg_len too large %u\n", - params->pkt.seg_len); + _ODP_ERR("pkt.seg_len too large %u\n", params->pkt.seg_len); return -1; } if (params->pkt.uarea_size > capa.pkt.max_uarea_size) { - ODP_ERR("pkt.uarea_size too large %u\n", - params->pkt.uarea_size); + _ODP_ERR("pkt.uarea_size too large %u\n", params->pkt.uarea_size); return -1; } if (params->pkt.headroom > capa.pkt.max_headroom) { - ODP_ERR("pkt.headroom too large %u\n", - params->pkt.headroom); + _ODP_ERR("pkt.headroom too large %u\n", params->pkt.headroom); return -1; } if (params->stats.all & ~capa.pkt.stats.all) { - ODP_ERR("Unsupported pool statistics counter\n"); + _ODP_ERR("Unsupported pool statistics counter\n"); return -1; } @@ -1063,17 +1057,17 @@ static int check_params(const odp_pool_param_t *params) cache_size = params->tmo.cache_size; if (params->tmo.num > capa.tmo.max_num) { - ODP_ERR("tmo.num too large %u\n", params->tmo.num); + _ODP_ERR("tmo.num too large %u\n", params->tmo.num); return -1; } if (params->tmo.uarea_size > capa.tmo.max_uarea_size) { - ODP_ERR("tmo.uarea_size too large %u\n", params->tmo.uarea_size); + _ODP_ERR("tmo.uarea_size too large %u\n", params->tmo.uarea_size); return -1; } if (params->stats.all & ~capa.tmo.stats.all) { - ODP_ERR("Unsupported pool statistics counter\n"); + _ODP_ERR("Unsupported pool statistics counter\n"); return -1; } @@ -1084,49 +1078,49 @@ static int check_params(const odp_pool_param_t *params) cache_size = params->vector.cache_size; if (params->vector.num == 0) { - ODP_ERR("vector.num zero\n"); + _ODP_ERR("vector.num zero\n"); return -1; } if (params->vector.num > capa.vector.max_num) { - ODP_ERR("vector.num too large %u\n", params->vector.num); + _ODP_ERR("vector.num too large %u\n", params->vector.num); return -1; } if (params->vector.max_size == 0) { - ODP_ERR("vector.max_size zero\n"); + _ODP_ERR("vector.max_size zero\n"); return -1; } if (params->vector.max_size > capa.vector.max_size) { - ODP_ERR("vector.max_size too large %u\n", params->vector.max_size); + _ODP_ERR("vector.max_size too large %u\n", params->vector.max_size); return -1; } if (params->vector.uarea_size > capa.vector.max_uarea_size) { - ODP_ERR("vector.uarea_size too large %u\n", params->vector.uarea_size); + _ODP_ERR("vector.uarea_size too large %u\n", params->vector.uarea_size); return -1; } if (params->stats.all & ~capa.vector.stats.all) { - ODP_ERR("Unsupported pool statistics counter\n"); + _ODP_ERR("Unsupported pool statistics counter\n"); return -1; } break; default: - ODP_ERR("bad pool type %i\n", params->type); + _ODP_ERR("bad pool type %i\n", params->type); return -1; } if (cache_size > CONFIG_POOL_CACHE_MAX_SIZE) { - ODP_ERR("Too large cache size %u\n", cache_size); + _ODP_ERR("Too large cache size %u\n", cache_size); return -1; } if (num <= (num_threads * cache_size)) - ODP_DBG("Entire pool fits into thread local caches. Pool " + _ODP_DBG("Entire pool fits into thread local caches. Pool " "starvation may occur if the pool is used by multiple " "threads.\n"); @@ -1153,7 +1147,7 @@ int odp_pool_destroy(odp_pool_t pool_hdl) if (pool->reserved == 0) { UNLOCK(&pool->lock); - ODP_ERR("Pool not created\n"); + _ODP_ERR("Pool not created\n"); return -1; } @@ -1382,11 +1376,11 @@ odp_buffer_t odp_buffer_alloc(odp_pool_t pool_hdl) pool_t *pool; int ret; - ODP_ASSERT(ODP_POOL_INVALID != pool_hdl); + _ODP_ASSERT(ODP_POOL_INVALID != pool_hdl); pool = _odp_pool_entry(pool_hdl); - ODP_ASSERT(pool->type == ODP_POOL_BUFFER); + _ODP_ASSERT(pool->type == ODP_POOL_BUFFER); ret = _odp_event_alloc_multi(pool, (_odp_event_hdr_t **)&buf, 1); @@ -1413,11 +1407,11 @@ int odp_buffer_alloc_multi(odp_pool_t pool_hdl, odp_buffer_t buf[], int num) { pool_t *pool; - ODP_ASSERT(ODP_POOL_INVALID != pool_hdl); + _ODP_ASSERT(ODP_POOL_INVALID != pool_hdl); pool = _odp_pool_entry(pool_hdl); - ODP_ASSERT(pool->type == ODP_POOL_BUFFER); + _ODP_ASSERT(pool->type == ODP_POOL_BUFFER); return _odp_event_alloc_multi(pool, (_odp_event_hdr_t **)buf, num); } @@ -1505,39 +1499,37 @@ void odp_pool_print(odp_pool_t pool_hdl) pool = _odp_pool_entry(pool_hdl); - ODP_PRINT("\nPool info\n"); - ODP_PRINT("---------\n"); - ODP_PRINT(" pool %" PRIu64 "\n", - odp_pool_to_u64(_odp_pool_handle(pool))); - ODP_PRINT(" name %s\n", pool->name); - ODP_PRINT(" pool type %s\n", - pool->type == ODP_POOL_BUFFER ? "buffer" : - (pool->type == ODP_POOL_PACKET ? "packet" : - (pool->type == ODP_POOL_TIMEOUT ? "timeout" : - (pool->type == ODP_POOL_VECTOR ? "vector" : - "unknown")))); - ODP_PRINT(" pool shm %" PRIu64 "\n", - odp_shm_to_u64(pool->shm)); - ODP_PRINT(" user area shm %" PRIu64 "\n", - odp_shm_to_u64(pool->uarea_shm)); - ODP_PRINT(" num %u\n", pool->num); - ODP_PRINT(" align %u\n", pool->align); - ODP_PRINT(" headroom %u\n", pool->headroom); - ODP_PRINT(" seg len %u\n", pool->seg_len); - ODP_PRINT(" max data len %u\n", pool->max_len); - ODP_PRINT(" tailroom %u\n", pool->tailroom); - ODP_PRINT(" block size %u\n", pool->block_size); - ODP_PRINT(" uarea size %u\n", pool->uarea_size); - ODP_PRINT(" shm size %" PRIu64 "\n", pool->shm_size); - ODP_PRINT(" base addr %p\n", (void *)pool->base_addr); - ODP_PRINT(" max addr %p\n", (void *)pool->max_addr); - ODP_PRINT(" uarea shm size %" PRIu64 "\n", pool->uarea_shm_size); - ODP_PRINT(" uarea base addr %p\n", (void *)pool->uarea_base_addr); - ODP_PRINT(" cache size %u\n", pool->cache_size); - ODP_PRINT(" burst size %u\n", pool->burst_size); - ODP_PRINT(" mem src %s\n", - pool->mem_src_ops ? pool->mem_src_ops->name : "(none)"); - ODP_PRINT("\n"); + _ODP_PRINT("\nPool info\n"); + _ODP_PRINT("---------\n"); + _ODP_PRINT(" pool %" PRIu64 "\n", + odp_pool_to_u64(_odp_pool_handle(pool))); + _ODP_PRINT(" name %s\n", pool->name); + _ODP_PRINT(" pool type %s\n", + pool->type == ODP_POOL_BUFFER ? "buffer" : + (pool->type == ODP_POOL_PACKET ? "packet" : + (pool->type == ODP_POOL_TIMEOUT ? "timeout" : + (pool->type == ODP_POOL_VECTOR ? "vector" : + "unknown")))); + _ODP_PRINT(" pool shm %" PRIu64 "\n", odp_shm_to_u64(pool->shm)); + _ODP_PRINT(" user area shm %" PRIu64 "\n", odp_shm_to_u64(pool->uarea_shm)); + _ODP_PRINT(" num %u\n", pool->num); + _ODP_PRINT(" align %u\n", pool->align); + _ODP_PRINT(" headroom %u\n", pool->headroom); + _ODP_PRINT(" seg len %u\n", pool->seg_len); + _ODP_PRINT(" max data len %u\n", pool->max_len); + _ODP_PRINT(" tailroom %u\n", pool->tailroom); + _ODP_PRINT(" block size %u\n", pool->block_size); + _ODP_PRINT(" uarea size %u\n", pool->uarea_size); + _ODP_PRINT(" shm size %" PRIu64 "\n", pool->shm_size); + _ODP_PRINT(" base addr %p\n", (void *)pool->base_addr); + _ODP_PRINT(" max addr %p\n", (void *)pool->max_addr); + _ODP_PRINT(" uarea shm size %" PRIu64 "\n", pool->uarea_shm_size); + _ODP_PRINT(" uarea base addr %p\n", (void *)pool->uarea_base_addr); + _ODP_PRINT(" cache size %u\n", pool->cache_size); + _ODP_PRINT(" burst size %u\n", pool->burst_size); + _ODP_PRINT(" mem src %s\n", + pool->mem_src_ops ? pool->mem_src_ops->name : "(none)"); + _ODP_PRINT("\n"); } void odp_pool_print_all(void) @@ -1550,9 +1542,9 @@ void odp_pool_print_all(void) const char *name; char type_c; - ODP_PRINT("\nList of all pools\n"); - ODP_PRINT("-----------------\n"); - ODP_PRINT(" idx %-*s type free tot cache buf_len ext\n", col_width, "name"); + _ODP_PRINT("\nList of all pools\n"); + _ODP_PRINT("-----------------\n"); + _ODP_PRINT(" idx %-*s type free tot cache buf_len ext\n", col_width, "name"); for (i = 0; i < ODP_CONFIG_POOLS; i++) { pool_t *pool = _odp_pool_entry_from_idx(i); @@ -1583,11 +1575,11 @@ void odp_pool_print_all(void) (type == ODP_POOL_TIMEOUT) ? 'T' : (type == ODP_POOL_VECTOR) ? 'V' : '-'; - ODP_PRINT("%4u %-*s %c %6" PRIu64 " %6" PRIu32 " %6" PRIu32 " %8" PRIu32 " " + _ODP_PRINT("%4u %-*s %c %6" PRIu64 " %6" PRIu32 " %6" PRIu32 " %8" PRIu32 " " "%" PRIu8 "\n", index, col_width, name, type_c, available, tot, cache_size, buf_len, ext); } - ODP_PRINT("\n"); + _ODP_PRINT("\n"); } void odp_pool_param_init(odp_pool_param_t *params) @@ -1618,11 +1610,11 @@ int odp_pool_stats(odp_pool_t pool_hdl, odp_pool_stats_t *stats) uint16_t first, last; if (odp_unlikely(pool_hdl == ODP_POOL_INVALID)) { - ODP_ERR("Invalid pool handle\n"); + _ODP_ERR("Invalid pool handle\n"); return -1; } if (odp_unlikely(stats == NULL)) { - ODP_ERR("Output buffer NULL\n"); + _ODP_ERR("Output buffer NULL\n"); return -1; } @@ -1671,7 +1663,7 @@ int odp_pool_stats_reset(odp_pool_t pool_hdl) pool_t *pool; if (odp_unlikely(pool_hdl == ODP_POOL_INVALID)) { - ODP_ERR("Invalid pool handle\n"); + _ODP_ERR("Invalid pool handle\n"); return -1; } @@ -1793,47 +1785,47 @@ static int check_pool_ext_param(const odp_pool_ext_param_t *param) uint32_t head_offset = sizeof(odp_packet_hdr_t) + param->pkt.app_header_size; if (param->type != ODP_POOL_PACKET) { - ODP_ERR("Pool type not supported\n"); + _ODP_ERR("Pool type not supported\n"); return -1; } if (odp_pool_ext_capability(param->type, &capa)) { - ODP_ERR("Capa failed\n"); + _ODP_ERR("Capa failed\n"); return -1; } if (param->cache_size > capa.max_cache_size) { - ODP_ERR("Too large cache size %u\n", param->cache_size); + _ODP_ERR("Too large cache size %u\n", param->cache_size); return -1; } if (param->stats.all != capa.stats.all) { - ODP_ERR("Pool statistics not supported\n"); + _ODP_ERR("Pool statistics not supported\n"); return -1; } if (param->pkt.num_buf > capa.pkt.max_num_buf) { - ODP_ERR("Too many packet buffers\n"); + _ODP_ERR("Too many packet buffers\n"); return -1; } if (param->pkt.buf_size > capa.pkt.max_buf_size) { - ODP_ERR("Too large packet buffer size %u\n", param->pkt.buf_size); + _ODP_ERR("Too large packet buffer size %u\n", param->pkt.buf_size); return -1; } if (param->pkt.uarea_size > capa.pkt.max_uarea_size) { - ODP_ERR("Too large user area size %u\n", param->pkt.uarea_size); + _ODP_ERR("Too large user area size %u\n", param->pkt.uarea_size); return -1; } if (param->pkt.headroom > capa.pkt.max_headroom) { - ODP_ERR("Too large headroom size\n"); + _ODP_ERR("Too large headroom size\n"); return -1; } if (head_offset % capa.pkt.min_head_align) { - ODP_ERR("Head pointer not %u byte aligned\n", capa.pkt.min_head_align); + _ODP_ERR("Head pointer not %u byte aligned\n", capa.pkt.min_head_align); return -1; } @@ -1851,7 +1843,7 @@ odp_pool_t odp_pool_ext_create(const char *name, const odp_pool_ext_param_t *par uint32_t shm_flags = 0; if (check_pool_ext_param(param)) { - ODP_ERR("Bad pool ext param\n"); + _ODP_ERR("Bad pool ext param\n"); return ODP_POOL_INVALID; } @@ -1861,7 +1853,7 @@ odp_pool_t odp_pool_ext_create(const char *name, const odp_pool_ext_param_t *par pool = reserve_pool(shm_flags, 1, num_buf); if (pool == NULL) { - ODP_ERR("No more free pools\n"); + _ODP_ERR("No more free pools\n"); return ODP_POOL_INVALID; } @@ -1870,7 +1862,7 @@ odp_pool_t odp_pool_ext_create(const char *name, const odp_pool_ext_param_t *par set_pool_cache_size(pool, param->cache_size); if (reserve_uarea(pool, param->pkt.uarea_size, num_buf, shm_flags)) { - ODP_ERR("User area SHM reserve failed\n"); + _ODP_ERR("User area SHM reserve failed\n"); goto error; } @@ -1919,14 +1911,14 @@ int odp_pool_ext_populate(odp_pool_t pool_hdl, void *buf[], uint32_t buf_size, u void *uarea = NULL; if (pool_hdl == ODP_POOL_INVALID) { - ODP_ERR("Bad pool handle\n"); + _ODP_ERR("Bad pool handle\n"); return -1; } pool = _odp_pool_entry(pool_hdl); if (pool->type != ODP_POOL_PACKET || pool->pool_ext == 0) { - ODP_ERR("Bad pool type\n"); + _ODP_ERR("Bad pool type\n"); return -1; } @@ -1934,24 +1926,24 @@ int odp_pool_ext_populate(odp_pool_t pool_hdl, void *buf[], uint32_t buf_size, u max_addr = pool->max_addr; if (buf_size != pool->ext_param.pkt.buf_size) { - ODP_ERR("Bad buffer size\n"); + _ODP_ERR("Bad buffer size\n"); return -1; } num_populated = pool->num_populated; if (num_populated + num > pool->num) { - ODP_ERR("Trying to over populate the pool\n"); + _ODP_ERR("Trying to over populate the pool\n"); return -1; } if ((num_populated + num == pool->num) && !(flags & ODP_POOL_POPULATE_DONE)) { - ODP_ERR("Missing ODP_POOL_POPULATE_DONE flag\n"); + _ODP_ERR("Missing ODP_POOL_POPULATE_DONE flag\n"); return -1; } if ((num_populated + num < pool->num) && flags) { - ODP_ERR("Unexpected flags: 0x%x\n", flags); + _ODP_ERR("Unexpected flags: 0x%x\n", flags); return -1; } @@ -1970,12 +1962,12 @@ int odp_pool_ext_populate(odp_pool_t pool_hdl, void *buf[], uint32_t buf_size, u max_addr = (uint8_t *)event_hdr; if ((uintptr_t)event_hdr & (ODP_CACHE_LINE_SIZE - 1)) { - ODP_ERR("Bad packet buffer align: buf[%u]\n", i); + _ODP_ERR("Bad packet buffer align: buf[%u]\n", i); return -1; } if (((uintptr_t)event_hdr + head_offset) & (MIN_HEAD_ALIGN - 1)) { - ODP_ERR("Bad head pointer align: buf[%u]\n", i); + _ODP_ERR("Bad head pointer align: buf[%u]\n", i); return -1; } diff --git a/platform/linux-generic/odp_queue_basic.c b/platform/linux-generic/odp_queue_basic.c index f485b7819..360f907bf 100644 --- a/platform/linux-generic/odp_queue_basic.c +++ b/platform/linux-generic/odp_queue_basic.c @@ -67,11 +67,11 @@ static int read_config_file(queue_global_t *_odp_queue_glb) uint32_t val_u32; int val = 0; - ODP_PRINT("Queue config:\n"); + _ODP_PRINT("Queue config:\n"); str = "queue_basic.max_queue_size"; if (!_odp_libconfig_lookup_int(str, &val)) { - ODP_ERR("Config option '%s' not found.\n", str); + _ODP_ERR("Config option '%s' not found.\n", str); return -1; } @@ -79,16 +79,16 @@ static int read_config_file(queue_global_t *_odp_queue_glb) if (val_u32 > MAX_QUEUE_SIZE || val_u32 < MIN_QUEUE_SIZE || !_ODP_CHECK_IS_POWER2(val_u32)) { - ODP_ERR("Bad value %s = %u\n", str, val_u32); + _ODP_ERR("Bad value %s = %u\n", str, val_u32); return -1; } _odp_queue_glb->config.max_queue_size = val_u32; - ODP_PRINT(" %s: %u\n", str, val_u32); + _ODP_PRINT(" %s: %u\n", str, val_u32); str = "queue_basic.default_queue_size"; if (!_odp_libconfig_lookup_int(str, &val)) { - ODP_ERR("Config option '%s' not found.\n", str); + _ODP_ERR("Config option '%s' not found.\n", str); return -1; } @@ -97,12 +97,12 @@ static int read_config_file(queue_global_t *_odp_queue_glb) if (val_u32 > _odp_queue_glb->config.max_queue_size || val_u32 < MIN_QUEUE_SIZE || !_ODP_CHECK_IS_POWER2(val_u32)) { - ODP_ERR("Bad value %s = %u\n", str, val_u32); + _ODP_ERR("Bad value %s = %u\n", str, val_u32); return -1; } _odp_queue_glb->config.default_queue_size = val_u32; - ODP_PRINT(" %s: %u\n\n", str, val_u32); + _ODP_PRINT(" %s: %u\n\n", str, val_u32); return 0; } @@ -116,7 +116,7 @@ static int queue_init_global(void) odp_queue_capability_t capa; uint64_t mem_size; - ODP_DBG("Starts...\n"); + _ODP_DBG("Starts...\n"); /* Fill in queue entry field offsets for inline functions */ memset(&_odp_queue_inline_offset, 0, @@ -171,12 +171,12 @@ static int queue_init_global(void) queue_capa(&capa, 0); - ODP_DBG("... done.\n"); - ODP_DBG(" queue_entry_t size %zu\n", sizeof(queue_entry_t)); - ODP_DBG(" max num queues %u\n", capa.max_queues); - ODP_DBG(" max queue size %u\n", capa.plain.max_size); - ODP_DBG(" max num lockfree %u\n", capa.plain.lockfree.max_num); - ODP_DBG(" max lockfree size %u\n\n", capa.plain.lockfree.max_size); + _ODP_DBG("... done.\n"); + _ODP_DBG(" queue_entry_t size %zu\n", sizeof(queue_entry_t)); + _ODP_DBG(" max num queues %u\n", capa.max_queues); + _ODP_DBG(" max queue size %u\n", capa.plain.max_size); + _ODP_DBG(" max num lockfree %u\n", capa.plain.lockfree.max_num); + _ODP_DBG(" max lockfree size %u\n\n", capa.plain.lockfree.max_size); return 0; } @@ -201,7 +201,7 @@ static int queue_term_global(void) queue = qentry_from_index(i); LOCK(queue); if (queue->status != QUEUE_STATUS_FREE) { - ODP_ERR("Not destroyed queue: %s\n", queue->name); + _ODP_ERR("Not destroyed queue: %s\n", queue->name); ret = -1; } UNLOCK(queue); @@ -210,12 +210,12 @@ static int queue_term_global(void) _odp_queue_lf_term_global(); if (odp_shm_free(_odp_queue_glb->queue_ring_shm)) { - ODP_ERR("shm free failed"); + _ODP_ERR("shm free failed"); ret = -1; } if (odp_shm_free(_odp_queue_glb->queue_gbl_shm)) { - ODP_ERR("shm free failed"); + _ODP_ERR("shm free failed"); ret = -1; } @@ -276,7 +276,7 @@ static odp_queue_t queue_create(const char *name, if (type == ODP_QUEUE_TYPE_SCHED) { if (param->sched.prio < odp_schedule_min_prio() || param->sched.prio > odp_schedule_max_prio()) { - ODP_ERR("Bad queue priority: %i\n", param->sched.prio); + _ODP_ERR("Bad queue priority: %i\n", param->sched.prio); return ODP_QUEUE_INVALID; } } @@ -359,7 +359,7 @@ static odp_queue_t queue_create(const char *name, if (_odp_sched_fn->create_queue(queue->index, &queue->param.sched)) { queue->status = QUEUE_STATUS_FREE; - ODP_ERR("schedule queue init failed\n"); + _ODP_ERR("schedule queue init failed\n"); return ODP_QUEUE_INVALID; } } @@ -391,12 +391,12 @@ static int queue_destroy(odp_queue_t handle) LOCK(queue); if (queue->status == QUEUE_STATUS_FREE) { UNLOCK(queue); - ODP_ERR("queue \"%s\" already free\n", queue->name); + _ODP_ERR("queue \"%s\" already free\n", queue->name); return -1; } if (queue->status == QUEUE_STATUS_DESTROYED) { UNLOCK(queue); - ODP_ERR("queue \"%s\" already destroyed\n", queue->name); + _ODP_ERR("queue \"%s\" already destroyed\n", queue->name); return -1; } @@ -409,7 +409,7 @@ static int queue_destroy(odp_queue_t handle) if (!empty) { UNLOCK(queue); - ODP_ERR("queue \"%s\" not empty\n", queue->name); + _ODP_ERR("queue \"%s\" not empty\n", queue->name); return -1; } @@ -426,7 +426,7 @@ static int queue_destroy(odp_queue_t handle) queue->status = QUEUE_STATUS_DESTROYED; break; default: - ODP_ABORT("Unexpected queue status\n"); + _ODP_ABORT("Unexpected queue status\n"); } if (queue->queue_lf) @@ -574,8 +574,7 @@ static int error_enqueue(odp_queue_t handle, _odp_event_hdr_t *event_hdr) { (void)event_hdr; - ODP_ERR("Enqueue not supported (0x%" PRIx64 ")\n", - odp_queue_to_u64(handle)); + _ODP_ERR("Enqueue not supported (0x%" PRIx64 ")\n", odp_queue_to_u64(handle)); return -1; } @@ -586,16 +585,14 @@ static int error_enqueue_multi(odp_queue_t handle, (void)event_hdr; (void)num; - ODP_ERR("Enqueue multi not supported (0x%" PRIx64 ")\n", - odp_queue_to_u64(handle)); + _ODP_ERR("Enqueue multi not supported (0x%" PRIx64 ")\n", odp_queue_to_u64(handle)); return -1; } static _odp_event_hdr_t *error_dequeue(odp_queue_t handle) { - ODP_ERR("Dequeue not supported (0x%" PRIx64 ")\n", - odp_queue_to_u64(handle)); + _ODP_ERR("Dequeue not supported (0x%" PRIx64 ")\n", odp_queue_to_u64(handle)); return NULL; } @@ -606,8 +603,7 @@ static int error_dequeue_multi(odp_queue_t handle, (void)event_hdr; (void)num; - ODP_ERR("Dequeue multi not supported (0x%" PRIx64 ")\n", - odp_queue_to_u64(handle)); + _ODP_ERR("Dequeue multi not supported (0x%" PRIx64 ")\n", odp_queue_to_u64(handle)); return -1; } @@ -632,15 +628,14 @@ static int queue_info(odp_queue_t handle, odp_queue_info_t *info) int status; if (odp_unlikely(info == NULL)) { - ODP_ERR("Unable to store info, NULL ptr given\n"); + _ODP_ERR("Unable to store info, NULL ptr given\n"); return -1; } queue_id = queue_to_index(handle); if (odp_unlikely(queue_id >= CONFIG_MAX_QUEUES)) { - ODP_ERR("Invalid queue handle: 0x%" PRIx64 "\n", - odp_queue_to_u64(handle)); + _ODP_ERR("Invalid queue handle: 0x%" PRIx64 "\n", odp_queue_to_u64(handle)); return -1; } @@ -652,7 +647,7 @@ static int queue_info(odp_queue_t handle, odp_queue_info_t *info) if (odp_unlikely(status == QUEUE_STATUS_FREE || status == QUEUE_STATUS_DESTROYED)) { UNLOCK(queue); - ODP_ERR("Invalid queue status:%d\n", status); + _ODP_ERR("Invalid queue status:%d\n", status); return -1; } @@ -675,8 +670,7 @@ static void queue_print(odp_queue_t handle) queue_id = queue_to_index(handle); if (odp_unlikely(queue_id >= CONFIG_MAX_QUEUES)) { - ODP_ERR("Invalid queue handle: 0x%" PRIx64 "\n", - odp_queue_to_u64(handle)); + _ODP_ERR("Invalid queue handle: 0x%" PRIx64 "\n", odp_queue_to_u64(handle)); return; } @@ -688,79 +682,78 @@ static void queue_print(odp_queue_t handle) if (odp_unlikely(status == QUEUE_STATUS_FREE || status == QUEUE_STATUS_DESTROYED)) { UNLOCK(queue); - ODP_ERR("Invalid queue status:%d\n", status); + _ODP_ERR("Invalid queue status:%d\n", status); return; } - ODP_PRINT("\nQueue info\n"); - ODP_PRINT("----------\n"); - ODP_PRINT(" handle %p\n", (void *)queue->handle); - ODP_PRINT(" index %" PRIu32 "\n", queue_id); - ODP_PRINT(" name %s\n", queue->name); - ODP_PRINT(" enq mode %s\n", - queue->param.enq_mode == ODP_QUEUE_OP_MT ? "ODP_QUEUE_OP_MT" : - (queue->param.enq_mode == ODP_QUEUE_OP_MT_UNSAFE ? "ODP_QUEUE_OP_MT_UNSAFE" : - (queue->param.enq_mode == ODP_QUEUE_OP_DISABLED ? "ODP_QUEUE_OP_DISABLED" : - "unknown"))); - ODP_PRINT(" deq mode %s\n", - queue->param.deq_mode == ODP_QUEUE_OP_MT ? "ODP_QUEUE_OP_MT" : - (queue->param.deq_mode == ODP_QUEUE_OP_MT_UNSAFE ? "ODP_QUEUE_OP_MT_UNSAFE" : - (queue->param.deq_mode == ODP_QUEUE_OP_DISABLED ? "ODP_QUEUE_OP_DISABLED" : - "unknown"))); - ODP_PRINT(" non-blocking %s\n", - queue->param.nonblocking == ODP_BLOCKING ? "ODP_BLOCKING" : - (queue->param.nonblocking == ODP_NONBLOCKING_LF ? "ODP_NONBLOCKING_LF" : - (queue->param.nonblocking == ODP_NONBLOCKING_WF ? "ODP_NONBLOCKING_WF" : - "unknown"))); - ODP_PRINT(" type %s\n", - queue->type == ODP_QUEUE_TYPE_PLAIN ? "ODP_QUEUE_TYPE_PLAIN" : - (queue->type == ODP_QUEUE_TYPE_SCHED ? "ODP_QUEUE_TYPE_SCHED" : "unknown")); + _ODP_PRINT("\nQueue info\n"); + _ODP_PRINT("----------\n"); + _ODP_PRINT(" handle %p\n", (void *)queue->handle); + _ODP_PRINT(" index %" PRIu32 "\n", queue_id); + _ODP_PRINT(" name %s\n", queue->name); + _ODP_PRINT(" enq mode %s\n", + queue->param.enq_mode == ODP_QUEUE_OP_MT ? "ODP_QUEUE_OP_MT" : + (queue->param.enq_mode == ODP_QUEUE_OP_MT_UNSAFE ? "ODP_QUEUE_OP_MT_UNSAFE" : + (queue->param.enq_mode == ODP_QUEUE_OP_DISABLED ? "ODP_QUEUE_OP_DISABLED" : + "unknown"))); + _ODP_PRINT(" deq mode %s\n", + queue->param.deq_mode == ODP_QUEUE_OP_MT ? "ODP_QUEUE_OP_MT" : + (queue->param.deq_mode == ODP_QUEUE_OP_MT_UNSAFE ? "ODP_QUEUE_OP_MT_UNSAFE" : + (queue->param.deq_mode == ODP_QUEUE_OP_DISABLED ? "ODP_QUEUE_OP_DISABLED" : + "unknown"))); + _ODP_PRINT(" non-blocking %s\n", + queue->param.nonblocking == ODP_BLOCKING ? "ODP_BLOCKING" : + (queue->param.nonblocking == ODP_NONBLOCKING_LF ? "ODP_NONBLOCKING_LF" : + (queue->param.nonblocking == ODP_NONBLOCKING_WF ? "ODP_NONBLOCKING_WF" : + "unknown"))); + _ODP_PRINT(" type %s\n", + queue->type == ODP_QUEUE_TYPE_PLAIN ? "ODP_QUEUE_TYPE_PLAIN" : + (queue->type == ODP_QUEUE_TYPE_SCHED ? "ODP_QUEUE_TYPE_SCHED" : "unknown")); if (queue->type == ODP_QUEUE_TYPE_SCHED) { - ODP_PRINT(" sync %s\n", - queue->param.sched.sync == ODP_SCHED_SYNC_PARALLEL ? - "ODP_SCHED_SYNC_PARALLEL" : - (queue->param.sched.sync == ODP_SCHED_SYNC_ATOMIC ? - "ODP_SCHED_SYNC_ATOMIC" : - (queue->param.sched.sync == ODP_SCHED_SYNC_ORDERED ? - "ODP_SCHED_SYNC_ORDERED" : "unknown"))); + _ODP_PRINT(" sync %s\n", + queue->param.sched.sync == ODP_SCHED_SYNC_PARALLEL ? + "ODP_SCHED_SYNC_PARALLEL" : + (queue->param.sched.sync == ODP_SCHED_SYNC_ATOMIC ? + "ODP_SCHED_SYNC_ATOMIC" : + (queue->param.sched.sync == ODP_SCHED_SYNC_ORDERED ? + "ODP_SCHED_SYNC_ORDERED" : "unknown"))); prio = queue->param.sched.prio; - ODP_PRINT(" priority %i (%i in API)\n", max_prio - prio, prio); - ODP_PRINT(" group %i\n", queue->param.sched.group); + _ODP_PRINT(" priority %i (%i in API)\n", max_prio - prio, prio); + _ODP_PRINT(" group %i\n", queue->param.sched.group); if (_odp_sched_id == _ODP_SCHED_ID_BASIC) - ODP_PRINT(" spread %i\n", _odp_sched_basic_get_spread(queue_id)); + _ODP_PRINT(" spread %i\n", _odp_sched_basic_get_spread(queue_id)); } if (queue->pktin.pktio != ODP_PKTIO_INVALID) { if (!odp_pktio_info(queue->pktin.pktio, &pktio_info)) - ODP_PRINT(" pktin %s\n", pktio_info.name); + _ODP_PRINT(" pktin %s\n", pktio_info.name); } if (queue->pktout.pktio != ODP_PKTIO_INVALID) { if (!odp_pktio_info(queue->pktout.pktio, &pktio_info)) - ODP_PRINT(" pktout %s\n", pktio_info.name); + _ODP_PRINT(" pktout %s\n", pktio_info.name); } - ODP_PRINT(" timers %" PRIu64 "\n", - odp_atomic_load_u64(&queue->num_timers)); - ODP_PRINT(" status %s\n", - queue->status == QUEUE_STATUS_READY ? "ready" : - (queue->status == QUEUE_STATUS_NOTSCHED ? "not scheduled" : - (queue->status == QUEUE_STATUS_SCHED ? "scheduled" : "unknown"))); - ODP_PRINT(" param.size %" PRIu32 "\n", queue->param.size); + _ODP_PRINT(" timers %" PRIu64 "\n", odp_atomic_load_u64(&queue->num_timers)); + _ODP_PRINT(" status %s\n", + queue->status == QUEUE_STATUS_READY ? "ready" : + (queue->status == QUEUE_STATUS_NOTSCHED ? "not scheduled" : + (queue->status == QUEUE_STATUS_SCHED ? "scheduled" : "unknown"))); + _ODP_PRINT(" param.size %" PRIu32 "\n", queue->param.size); if (queue->queue_lf) { - ODP_PRINT(" implementation queue_lf\n"); - ODP_PRINT(" length %" PRIu32 "/%" PRIu32 "\n", - _odp_queue_lf_length(queue->queue_lf), _odp_queue_lf_max_length()); + _ODP_PRINT(" implementation queue_lf\n"); + _ODP_PRINT(" length %" PRIu32 "/%" PRIu32 "\n", + _odp_queue_lf_length(queue->queue_lf), _odp_queue_lf_max_length()); } else if (queue->spsc) { - ODP_PRINT(" implementation ring_spsc\n"); - ODP_PRINT(" length %" PRIu32 "/%" PRIu32 "\n", - ring_spsc_length(&queue->ring_spsc), queue->ring_mask + 1); + _ODP_PRINT(" implementation ring_spsc\n"); + _ODP_PRINT(" length %" PRIu32 "/%" PRIu32 "\n", + ring_spsc_length(&queue->ring_spsc), queue->ring_mask + 1); } else if (queue->type == ODP_QUEUE_TYPE_SCHED) { - ODP_PRINT(" implementation ring_st\n"); - ODP_PRINT(" length %" PRIu32 "/%" PRIu32 "\n", - ring_st_length(&queue->ring_st), queue->ring_mask + 1); + _ODP_PRINT(" implementation ring_st\n"); + _ODP_PRINT(" length %" PRIu32 "/%" PRIu32 "\n", + ring_st_length(&queue->ring_st), queue->ring_mask + 1); } else { - ODP_PRINT(" implementation ring_mpmc\n"); - ODP_PRINT(" length %" PRIu32 "/%" PRIu32 "\n", - ring_mpmc_length(&queue->ring_mpmc), queue->ring_mask + 1); + _ODP_PRINT(" implementation ring_mpmc\n"); + _ODP_PRINT(" length %" PRIu32 "/%" PRIu32 "\n", + ring_mpmc_length(&queue->ring_mpmc), queue->ring_mask + 1); } - ODP_PRINT("\n"); + _ODP_PRINT("\n"); UNLOCK(queue); } @@ -784,13 +777,13 @@ static void queue_print_all(void) odp_schedule_sync_t sync = ODP_SCHED_SYNC_PARALLEL; odp_schedule_group_t grp = ODP_SCHED_GROUP_INVALID; - ODP_PRINT("\nList of all queues\n"); - ODP_PRINT("------------------\n"); - ODP_PRINT(" idx %-*s type stat blk enq deq ord len max_len sync prio grp", col_width, "name"); + _ODP_PRINT("\nList of all queues\n"); + _ODP_PRINT("------------------\n"); + _ODP_PRINT(" idx %-*s type stat blk enq deq ord len max_len sync prio grp", col_width, "name"); if (_odp_sched_id == _ODP_SCHED_ID_BASIC) - ODP_PRINT(" spr\n"); + _ODP_PRINT(" spr\n"); else - ODP_PRINT("\n"); + _ODP_PRINT("\n"); for (i = 0; i < CONFIG_MAX_QUEUES; i++) { queue_entry_t *queue = qentry_from_index(i); @@ -849,9 +842,9 @@ static void queue_print_all(void) order_c = (order == ODP_QUEUE_ORDER_KEEP) ? 'K' : 'I'; - ODP_PRINT("%4u %-*s %c %2s %2s", index, col_width, name, type_c, - status_str, bl_str); - ODP_PRINT(" %c %c %c %6u %6u", enq_c, deq_c, order_c, len, max_len); + _ODP_PRINT("%4u %-*s %c %2s %2s", index, col_width, name, type_c, + status_str, bl_str); + _ODP_PRINT(" %c %c %c %6u %6u", enq_c, deq_c, order_c, len, max_len); if (type == ODP_QUEUE_TYPE_SCHED) { sync_c = (sync == ODP_SCHED_SYNC_PARALLEL) ? 'P' : @@ -859,16 +852,16 @@ static void queue_print_all(void) /* Print prio level matching odp_schedule_print() output */ prio = odp_schedule_max_prio() - prio; - ODP_PRINT(" %c %4i %3i", sync_c, prio, grp); + _ODP_PRINT(" %c %4i %3i", sync_c, prio, grp); if (_odp_sched_id == _ODP_SCHED_ID_BASIC) - ODP_PRINT(" %3i", spr); + _ODP_PRINT(" %3i", spr); } - ODP_PRINT("\n"); + _ODP_PRINT("\n"); } - ODP_PRINT("\n"); + _ODP_PRINT("\n"); } static inline int _sched_queue_enq_multi(odp_queue_t handle, @@ -908,7 +901,7 @@ static inline int _sched_queue_enq_multi(odp_queue_t handle, /* Add queue to scheduling */ if (sched && _odp_sched_fn->sched_queue(queue->index)) - ODP_ABORT("schedule_queue failed\n"); + _ODP_ABORT("schedule_queue failed\n"); return num_enq; } @@ -1043,7 +1036,7 @@ static int queue_init(queue_entry_t *queue, const char *name, queue_size = _ODP_ROUNDUP_POWER2_U32(queue_size); if (queue_size > _odp_queue_glb->config.max_queue_size) { - ODP_ERR("Too large queue size %u\n", queue_size); + _ODP_ERR("Too large queue size %u\n", queue_size); return -1; } diff --git a/platform/linux-generic/odp_queue_if.c b/platform/linux-generic/odp_queue_if.c index 9ebd5db86..b702e0105 100644 --- a/platform/linux-generic/odp_queue_if.c +++ b/platform/linux-generic/odp_queue_if.c @@ -120,7 +120,7 @@ int _odp_queue_init_global(void) _odp_queue_fn = &_odp_queue_scalable_fn; _odp_queue_api = &_odp_queue_scalable_api; } else { - ODP_ABORT("Unknown scheduler specified via ODP_SCHEDULER\n"); + _ODP_ABORT("Unknown scheduler specified via ODP_SCHEDULER\n"); return -1; } diff --git a/platform/linux-generic/odp_queue_lf.c b/platform/linux-generic/odp_queue_lf.c index f511bcec5..9004402b8 100644 --- a/platform/linux-generic/odp_queue_lf.c +++ b/platform/linux-generic/odp_queue_lf.c @@ -264,8 +264,8 @@ uint32_t _odp_queue_lf_init_global(uint32_t *queue_lf_size, /* 16 byte lockfree CAS operation is needed. */ lockfree = lockfree_check_u128(); - ODP_DBG("\nLock-free queue init\n"); - ODP_DBG(" u128 lock-free: %i\n\n", lockfree); + _ODP_DBG("\nLock-free queue init\n"); + _ODP_DBG(" u128 lock-free: %i\n\n", lockfree); if (!lockfree) return 0; @@ -302,7 +302,7 @@ void _odp_queue_lf_term_global(void) shm = queue_lf_glb->shm; if (odp_shm_free(shm) < 0) - ODP_ERR("shm free failed"); + _ODP_ERR("shm free failed"); } static void init_queue(queue_lf_t *queue_lf) @@ -321,7 +321,7 @@ void *_odp_queue_lf_create(queue_entry_t *queue) queue_lf_t *queue_lf = NULL; if (queue_lf_glb == NULL) { - ODP_ERR("No lock-free queues available\n"); + _ODP_ERR("No lock-free queues available\n"); return NULL; } diff --git a/platform/linux-generic/odp_queue_scalable.c b/platform/linux-generic/odp_queue_scalable.c index 049e7dae8..4a4be1ecf 100644 --- a/platform/linux-generic/odp_queue_scalable.c +++ b/platform/linux-generic/odp_queue_scalable.c @@ -170,7 +170,7 @@ static int queue_init(queue_entry_t *queue, const char *name, _odp_rwin_alloc(queue_shm_pool, queue->param.sched.lock_count); if (sched_elem->rwin == NULL) { - ODP_ERR("Reorder window not created\n"); + _ODP_ERR("Reorder window not created\n"); goto rwin_create_failed; } } @@ -178,7 +178,7 @@ static int queue_init(queue_entry_t *queue, const char *name, sched_elem->sched_prio = prio; sched_elem->schedq = _odp_sched_queue_add(param->sched.group, prio); - ODP_ASSERT(sched_elem->schedq != NULL); + _ODP_ASSERT(sched_elem->schedq != NULL); } return 0; @@ -196,7 +196,7 @@ static int queue_init_global(void) uint64_t min_alloc; uint64_t max_alloc; - ODP_DBG("Queue init ... "); + _ODP_DBG("Queue init ... "); /* Fill in queue entry field offsets for inline functions */ memset(&_odp_queue_inline_offset, 0, @@ -222,7 +222,7 @@ static int queue_init_global(void) pool_size, min_alloc, max_alloc, 0); if (queue_shm_pool == NULL) { - ODP_ERR("Failed to allocate shared memory pool for" + _ODP_ERR("Failed to allocate shared memory pool for" " queues\n"); goto queue_shm_pool_create_failed; } @@ -231,7 +231,7 @@ static int queue_init_global(void) shm_pool_alloc_align(queue_shm_pool, sizeof(queue_table_t)); if (queue_tbl == NULL) { - ODP_ERR("Failed to reserve shared memory for queue table\n"); + _ODP_ERR("Failed to reserve shared memory for queue table\n"); goto queue_tbl_ishm_alloc_failed; } @@ -247,13 +247,11 @@ static int queue_init_global(void) queue->handle = (odp_queue_t)queue; } - ODP_DBG("done\n"); - ODP_DBG("Queue init global\n"); - ODP_DBG(" struct queue_entry_s size %zu\n", - sizeof(struct queue_entry_s)); - ODP_DBG(" queue_entry_t size %zu\n", - sizeof(queue_entry_t)); - ODP_DBG("\n"); + _ODP_DBG("done\n"); + _ODP_DBG("Queue init global\n"); + _ODP_DBG(" struct queue_entry_s size %zu\n", sizeof(struct queue_entry_s)); + _ODP_DBG(" queue_entry_t size %zu\n", sizeof(queue_entry_t)); + _ODP_DBG("\n"); return 0; @@ -276,7 +274,7 @@ static int queue_term_global(void) queue = &queue_tbl->queue[i]; if (__atomic_load_n(&queue->status, __ATOMIC_RELAXED) != QUEUE_STATUS_FREE) { - ODP_ERR("Not destroyed queue: %s\n", queue->name); + _ODP_ERR("Not destroyed queue: %s\n", queue->name); rc = -1; } } @@ -285,7 +283,7 @@ static int queue_term_global(void) ret = _odp_ishm_pool_destroy(queue_shm_pool); if (ret < 0) { - ODP_ERR("Failed to destroy shared memory pool for queues\n"); + _ODP_ERR("Failed to destroy shared memory pool for queues\n"); rc = -1; } @@ -363,7 +361,7 @@ static odp_queue_t queue_create(const char *name, if (type == ODP_QUEUE_TYPE_SCHED) { if (param->sched.prio < odp_schedule_min_prio() || param->sched.prio > odp_schedule_max_prio()) { - ODP_ERR("Bad queue priority: %i\n", param->sched.prio); + _ODP_ERR("Bad queue priority: %i\n", param->sched.prio); return ODP_QUEUE_INVALID; } } @@ -467,7 +465,7 @@ static int queue_destroy(odp_queue_t handle) if (q->rwin != NULL) { if (_odp_rwin_free(queue_shm_pool, q->rwin) < 0) { - ODP_ERR("Failed to free reorder window\n"); + _ODP_ERR("Failed to free reorder window\n"); UNLOCK(&queue->lock); return -1; } @@ -897,15 +895,14 @@ static int queue_info(odp_queue_t handle, odp_queue_info_t *info) int status; if (odp_unlikely(info == NULL)) { - ODP_ERR("Unable to store info, NULL ptr given\n"); + _ODP_ERR("Unable to store info, NULL ptr given\n"); return -1; } queue_id = queue_to_id(handle); if (odp_unlikely(queue_id >= CONFIG_MAX_QUEUES)) { - ODP_ERR("Invalid queue handle:%" PRIu64 "\n", - odp_queue_to_u64(handle)); + _ODP_ERR("Invalid queue handle:%" PRIu64 "\n", odp_queue_to_u64(handle)); return -1; } @@ -917,7 +914,7 @@ static int queue_info(odp_queue_t handle, odp_queue_info_t *info) if (odp_unlikely(status == QUEUE_STATUS_FREE || status == QUEUE_STATUS_DESTROYED)) { UNLOCK(&queue->lock); - ODP_ERR("Invalid queue status:%d\n", status); + _ODP_ERR("Invalid queue status:%d\n", status); return -1; } @@ -939,8 +936,7 @@ static void queue_print(odp_queue_t handle) queue_id = queue_to_id(handle); if (odp_unlikely(queue_id >= CONFIG_MAX_QUEUES)) { - ODP_ERR("Invalid queue handle: 0x%" PRIx64 "\n", - odp_queue_to_u64(handle)); + _ODP_ERR("Invalid queue handle: 0x%" PRIx64 "\n", odp_queue_to_u64(handle)); return; } @@ -952,50 +948,49 @@ static void queue_print(odp_queue_t handle) if (odp_unlikely(status == QUEUE_STATUS_FREE || status == QUEUE_STATUS_DESTROYED)) { UNLOCK(&queue->lock); - ODP_ERR("Invalid queue status:%d\n", status); + _ODP_ERR("Invalid queue status:%d\n", status); return; } - ODP_PRINT("\nQueue info\n"); - ODP_PRINT("----------\n"); - ODP_PRINT(" handle %p\n", (void *)queue->handle); - ODP_PRINT(" index %" PRIu32 "\n", queue->index); - ODP_PRINT(" name %s\n", queue->name); - ODP_PRINT(" enq mode %s\n", - queue->param.enq_mode == ODP_QUEUE_OP_MT ? "ODP_QUEUE_OP_MT" : - (queue->param.enq_mode == ODP_QUEUE_OP_MT_UNSAFE ? "ODP_QUEUE_OP_MT_UNSAFE" : - (queue->param.enq_mode == ODP_QUEUE_OP_DISABLED ? "ODP_QUEUE_OP_DISABLED" : - "unknown"))); - ODP_PRINT(" deq mode %s\n", - queue->param.deq_mode == ODP_QUEUE_OP_MT ? "ODP_QUEUE_OP_MT" : - (queue->param.deq_mode == ODP_QUEUE_OP_MT_UNSAFE ? "ODP_QUEUE_OP_MT_UNSAFE" : - (queue->param.deq_mode == ODP_QUEUE_OP_DISABLED ? "ODP_QUEUE_OP_DISABLED" : - "unknown"))); - ODP_PRINT(" type %s\n", - queue->type == ODP_QUEUE_TYPE_PLAIN ? "ODP_QUEUE_TYPE_PLAIN" : - (queue->type == ODP_QUEUE_TYPE_SCHED ? "ODP_QUEUE_TYPE_SCHED" : "unknown")); + _ODP_PRINT("\nQueue info\n"); + _ODP_PRINT("----------\n"); + _ODP_PRINT(" handle %p\n", (void *)queue->handle); + _ODP_PRINT(" index %" PRIu32 "\n", queue->index); + _ODP_PRINT(" name %s\n", queue->name); + _ODP_PRINT(" enq mode %s\n", + queue->param.enq_mode == ODP_QUEUE_OP_MT ? "ODP_QUEUE_OP_MT" : + (queue->param.enq_mode == ODP_QUEUE_OP_MT_UNSAFE ? "ODP_QUEUE_OP_MT_UNSAFE" : + (queue->param.enq_mode == ODP_QUEUE_OP_DISABLED ? "ODP_QUEUE_OP_DISABLED" : + "unknown"))); + _ODP_PRINT(" deq mode %s\n", + queue->param.deq_mode == ODP_QUEUE_OP_MT ? "ODP_QUEUE_OP_MT" : + (queue->param.deq_mode == ODP_QUEUE_OP_MT_UNSAFE ? "ODP_QUEUE_OP_MT_UNSAFE" : + (queue->param.deq_mode == ODP_QUEUE_OP_DISABLED ? "ODP_QUEUE_OP_DISABLED" : + "unknown"))); + _ODP_PRINT(" type %s\n", + queue->type == ODP_QUEUE_TYPE_PLAIN ? "ODP_QUEUE_TYPE_PLAIN" : + (queue->type == ODP_QUEUE_TYPE_SCHED ? "ODP_QUEUE_TYPE_SCHED" : "unknown")); if (queue->type == ODP_QUEUE_TYPE_SCHED) { - ODP_PRINT(" sync %s\n", - queue->param.sched.sync == ODP_SCHED_SYNC_PARALLEL ? - "ODP_SCHED_SYNC_PARALLEL" : - (queue->param.sched.sync == ODP_SCHED_SYNC_ATOMIC ? - "ODP_SCHED_SYNC_ATOMIC" : - (queue->param.sched.sync == ODP_SCHED_SYNC_ORDERED ? - "ODP_SCHED_SYNC_ORDERED" : "unknown"))); - ODP_PRINT(" priority %d\n", queue->param.sched.prio); - ODP_PRINT(" group %d\n", queue->param.sched.group); + _ODP_PRINT(" sync %s\n", + queue->param.sched.sync == ODP_SCHED_SYNC_PARALLEL ? + "ODP_SCHED_SYNC_PARALLEL" : + (queue->param.sched.sync == ODP_SCHED_SYNC_ATOMIC ? + "ODP_SCHED_SYNC_ATOMIC" : + (queue->param.sched.sync == ODP_SCHED_SYNC_ORDERED ? + "ODP_SCHED_SYNC_ORDERED" : "unknown"))); + _ODP_PRINT(" priority %d\n", queue->param.sched.prio); + _ODP_PRINT(" group %d\n", queue->param.sched.group); } if (queue->pktin.pktio != ODP_PKTIO_INVALID) { if (!odp_pktio_info(queue->pktin.pktio, &pktio_info)) - ODP_PRINT(" pktin %s\n", pktio_info.name); + _ODP_PRINT(" pktin %s\n", pktio_info.name); } if (queue->pktout.pktio != ODP_PKTIO_INVALID) { if (!odp_pktio_info(queue->pktout.pktio, &pktio_info)) - ODP_PRINT(" pktout %s\n", pktio_info.name); + _ODP_PRINT(" pktout %s\n", pktio_info.name); } - ODP_PRINT(" timers %" PRIu64 "\n", - odp_atomic_load_u64(&queue->num_timers)); - ODP_PRINT(" param.size %" PRIu32 "\n", queue->param.size); - ODP_PRINT("\n"); + _ODP_PRINT(" timers %" PRIu64 "\n", odp_atomic_load_u64(&queue->num_timers)); + _ODP_PRINT(" param.size %" PRIu32 "\n", queue->param.size); + _ODP_PRINT("\n"); UNLOCK(&queue->lock); } @@ -1016,9 +1011,9 @@ static void queue_print_all(void) char type_c, enq_c, deq_c, order_c, sync_c; const int col_width = 24; - ODP_PRINT("\nList of all queues\n"); - ODP_PRINT("------------------\n"); - ODP_PRINT(" idx %-*s type blk enq deq ord sync prio\n", col_width, "name"); + _ODP_PRINT("\nList of all queues\n"); + _ODP_PRINT("------------------\n"); + _ODP_PRINT(" idx %-*s type blk enq deq ord sync prio\n", col_width, "name"); for (i = 0; i < CONFIG_MAX_QUEUES; i++) { queue_entry_t *queue = &queue_tbl->queue[i]; @@ -1057,19 +1052,19 @@ static void queue_print_all(void) order_c = (order == ODP_QUEUE_ORDER_KEEP) ? 'K' : 'I'; - ODP_PRINT("%4u %-*s %c %2s", index, col_width, name, type_c, bl_str); - ODP_PRINT(" %c %c %c", enq_c, deq_c, order_c); + _ODP_PRINT("%4u %-*s %c %2s", index, col_width, name, type_c, bl_str); + _ODP_PRINT(" %c %c %c", enq_c, deq_c, order_c); if (type == ODP_QUEUE_TYPE_SCHED) { sync_c = (sync == ODP_SCHED_SYNC_PARALLEL) ? 'P' : ((sync == ODP_SCHED_SYNC_ATOMIC) ? 'A' : 'O'); - ODP_PRINT(" %c %4i", sync_c, prio); + _ODP_PRINT(" %c %4i", sync_c, prio); } - ODP_PRINT("\n"); + _ODP_PRINT("\n"); } - ODP_PRINT("\n"); + _ODP_PRINT("\n"); } static uint64_t queue_to_u64(odp_queue_t hdl) diff --git a/platform/linux-generic/odp_queue_spsc.c b/platform/linux-generic/odp_queue_spsc.c index b2fed7d0d..74cc740e0 100644 --- a/platform/linux-generic/odp_queue_spsc.c +++ b/platform/linux-generic/odp_queue_spsc.c @@ -46,7 +46,7 @@ static inline int spsc_enq_multi(odp_queue_t handle, event_index_from_hdr(buf_idx, event_hdr, num); if (odp_unlikely(queue->status < QUEUE_STATUS_READY)) { - ODP_ERR("Bad queue status\n"); + _ODP_ERR("Bad queue status\n"); return -1; } diff --git a/platform/linux-generic/odp_schedule_basic.c b/platform/linux-generic/odp_schedule_basic.c index 112c392ec..a3c53848f 100644 --- a/platform/linux-generic/odp_schedule_basic.c +++ b/platform/linux-generic/odp_schedule_basic.c @@ -320,7 +320,7 @@ static int read_burst_size_conf(uint8_t out_tbl[], const char *conf_str, if (_odp_libconfig_lookup_array(conf_str, burst_val, NUM_PRIO) != NUM_PRIO) { - ODP_ERR("Config option '%s' not found.\n", conf_str); + _ODP_ERR("Config option '%s' not found.\n", conf_str); return -1; } @@ -333,7 +333,7 @@ static int read_burst_size_conf(uint8_t out_tbl[], const char *conf_str, int val = burst_val[i]; if (val > max_val || val < min_val) { - ODP_ERR("Bad value for %s: %i\n", conf_str, val); + _ODP_ERR("Bad value for %s: %i\n", conf_str, val); return -1; } len += snprintf(&line[len], n - len, " %3i", val); @@ -341,7 +341,7 @@ static int read_burst_size_conf(uint8_t out_tbl[], const char *conf_str, out_tbl[i] = val; } if (print) - ODP_PRINT("%s\n", line); + _ODP_PRINT("%s\n", line); return 0; } @@ -351,49 +351,49 @@ static int read_config_file(sched_global_t *sched) const char *str; int val = 0; - ODP_PRINT("Scheduler config:\n"); + _ODP_PRINT("Scheduler config:\n"); str = "sched_basic.prio_spread"; if (!_odp_libconfig_lookup_int(str, &val)) { - ODP_ERR("Config option '%s' not found.\n", str); + _ODP_ERR("Config option '%s' not found.\n", str); return -1; } if (val > MAX_SPREAD || val < MIN_SPREAD) { - ODP_ERR("Bad value %s = %u [min: %u, max: %u]\n", str, val, - MIN_SPREAD, MAX_SPREAD); + _ODP_ERR("Bad value %s = %u [min: %u, max: %u]\n", str, val, + MIN_SPREAD, MAX_SPREAD); return -1; } sched->config.num_spread = val; - ODP_PRINT(" %s: %i\n", str, val); + _ODP_PRINT(" %s: %i\n", str, val); str = "sched_basic.prio_spread_weight"; if (!_odp_libconfig_lookup_int(str, &val)) { - ODP_ERR("Config option '%s' not found.\n", str); + _ODP_ERR("Config option '%s' not found.\n", str); return -1; } if (val > MAX_PREFER_WEIGHT || val < MIN_PREFER_WEIGHT) { - ODP_ERR("Bad value %s = %u [min: %u, max: %u]\n", str, val, - MIN_PREFER_WEIGHT, MAX_PREFER_WEIGHT); + _ODP_ERR("Bad value %s = %u [min: %u, max: %u]\n", str, val, + MIN_PREFER_WEIGHT, MAX_PREFER_WEIGHT); return -1; } sched->config.prefer_ratio = val + 1; - ODP_PRINT(" %s: %i\n", str, val); + _ODP_PRINT(" %s: %i\n", str, val); str = "sched_basic.load_balance"; if (!_odp_libconfig_lookup_int(str, &val)) { - ODP_ERR("Config option '%s' not found.\n", str); + _ODP_ERR("Config option '%s' not found.\n", str); return -1; } if (val > 1 || val < 0) { - ODP_ERR("Bad value %s = %i\n", str, val); + _ODP_ERR("Bad value %s = %i\n", str, val); return -1; } - ODP_PRINT(" %s: %i\n", str, val); + _ODP_PRINT(" %s: %i\n", str, val); sched->load_balance = 1; if (val == 0 || sched->config.num_spread == 1) @@ -444,34 +444,34 @@ static int read_config_file(sched_global_t *sched) str = "sched_basic.group_enable.all"; if (!_odp_libconfig_lookup_int(str, &val)) { - ODP_ERR("Config option '%s' not found.\n", str); + _ODP_ERR("Config option '%s' not found.\n", str); return -1; } sched->config_if.group_enable.all = val; - ODP_PRINT(" %s: %i\n", str, val); + _ODP_PRINT(" %s: %i\n", str, val); str = "sched_basic.group_enable.worker"; if (!_odp_libconfig_lookup_int(str, &val)) { - ODP_ERR("Config option '%s' not found.\n", str); + _ODP_ERR("Config option '%s' not found.\n", str); return -1; } sched->config_if.group_enable.worker = val; - ODP_PRINT(" %s: %i\n", str, val); + _ODP_PRINT(" %s: %i\n", str, val); str = "sched_basic.group_enable.control"; if (!_odp_libconfig_lookup_int(str, &val)) { - ODP_ERR("Config option '%s' not found.\n", str); + _ODP_ERR("Config option '%s' not found.\n", str); return -1; } sched->config_if.group_enable.control = val; - ODP_PRINT(" %s: %i\n", str, val); + _ODP_PRINT(" %s: %i\n", str, val); - ODP_PRINT(" dynamic load balance: %s\n", sched->load_balance ? "ON" : "OFF"); + _ODP_PRINT(" dynamic load balance: %s\n", sched->load_balance ? "ON" : "OFF"); - ODP_PRINT("\n"); + _ODP_PRINT("\n"); return 0; } @@ -517,14 +517,14 @@ static int schedule_init_global(void) int prefer_ratio; uint32_t ring_size, num_rings; - ODP_DBG("Schedule init ... "); + _ODP_DBG("Schedule init ... "); shm = odp_shm_reserve("_odp_sched_basic_global", sizeof(sched_global_t), ODP_CACHE_LINE_SIZE, 0); if (shm == ODP_SHM_INVALID) { - ODP_ERR("Schedule init: Shm reserve failed.\n"); + _ODP_ERR("Schedule init: Shm reserve failed.\n"); return -1; } @@ -553,7 +553,7 @@ static int schedule_init_global(void) } ring_size = _ODP_ROUNDUP_POWER2_U32(ring_size); - ODP_ASSERT(ring_size <= MAX_RING_SIZE); + _ODP_ASSERT(ring_size <= MAX_RING_SIZE); sched->ring_mask = ring_size - 1; /* Each ring can hold in maximum ring_size-1 queues. Due to ring size round up, @@ -604,7 +604,7 @@ static int schedule_init_global(void) odp_thrmask_setall(&sched->mask_all); - ODP_DBG("done\n"); + _ODP_DBG("done\n"); return 0; } @@ -631,7 +631,7 @@ static int schedule_term_global(void) num = _odp_sched_queue_deq(qi, events, 1, 1); if (num > 0) - ODP_ERR("Queue not empty\n"); + _ODP_ERR("Queue not empty\n"); } } } @@ -639,7 +639,7 @@ static int schedule_term_global(void) ret = odp_shm_free(sched->shm); if (ret < 0) { - ODP_ERR("Shm free failed for odp_scheduler"); + _ODP_ERR("Shm free failed for odp_scheduler"); rc = -1; } @@ -824,24 +824,24 @@ static int schedule_create_queue(uint32_t queue_index, int prio = prio_level_from_api(sched_param->prio); if (odp_global_rw->schedule_configured == 0) { - ODP_ERR("Scheduler has not been configured\n"); + _ODP_ERR("Scheduler has not been configured\n"); return -1; } if (grp < 0 || grp >= NUM_SCHED_GRPS) { - ODP_ERR("Bad schedule group %i\n", grp); + _ODP_ERR("Bad schedule group %i\n", grp); return -1; } if (grp == ODP_SCHED_GROUP_ALL && !sched->config_if.group_enable.all) { - ODP_ERR("Trying to use disabled ODP_SCHED_GROUP_ALL\n"); + _ODP_ERR("Trying to use disabled ODP_SCHED_GROUP_ALL\n"); return -1; } if (grp == ODP_SCHED_GROUP_CONTROL && !sched->config_if.group_enable.control) { - ODP_ERR("Trying to use disabled ODP_SCHED_GROUP_CONTROL\n"); + _ODP_ERR("Trying to use disabled ODP_SCHED_GROUP_CONTROL\n"); return -1; } if (grp == ODP_SCHED_GROUP_WORKER && !sched->config_if.group_enable.worker) { - ODP_ERR("Trying to use disabled ODP_SCHED_GROUP_WORKER\n"); + _ODP_ERR("Trying to use disabled ODP_SCHED_GROUP_WORKER\n"); return -1; } @@ -849,7 +849,7 @@ static int schedule_create_queue(uint32_t queue_index, if (sched->sched_grp[grp].allocated == 0) { odp_ticketlock_unlock(&sched->grp_lock); - ODP_ERR("Group not created: %i\n", grp); + _ODP_ERR("Group not created: %i\n", grp); return -1; } @@ -901,7 +901,7 @@ static void schedule_destroy_queue(uint32_t queue_index) if ((sched_sync_type(queue_index) == ODP_SCHED_SYNC_ORDERED) && odp_atomic_load_u64(&sched->order[queue_index].ctx) != odp_atomic_load_u64(&sched->order[queue_index].next_ctx)) - ODP_ERR("queue reorder incomplete\n"); + _ODP_ERR("queue reorder incomplete\n"); } static int schedule_sched_queue(uint32_t queue_index) @@ -929,7 +929,7 @@ static void schedule_pktio_start(int pktio_index, int num_pktin, sched->queue[qi].pktio_index = pktio_index; sched->queue[qi].pktin_index = pktin_idx[i]; - ODP_ASSERT(pktin_idx[i] <= MAX_PKTIN_INDEX); + _ODP_ASSERT(pktin_idx[i] <= MAX_PKTIN_INDEX); /* Start polling */ _odp_sched_queue_set_status(qi, QUEUE_STATUS_SCHED); @@ -1001,7 +1001,7 @@ static inline void ordered_stash_release(void) if (odp_unlikely(num_enq < 0)) num_enq = 0; - ODP_DBG("Dropped %i packets\n", num - num_enq); + _ODP_DBG("Dropped %i packets\n", num - num_enq); _odp_event_free_multi(&event_hdr[num_enq], num - num_enq); } } @@ -1048,7 +1048,7 @@ static void schedule_release_ordered(void) static int schedule_term_local(void) { if (sched_local.stash.num_ev) { - ODP_ERR("Locally pre-scheduled events exist.\n"); + _ODP_ERR("Locally pre-scheduled events exist.\n"); return -1; } @@ -1076,7 +1076,7 @@ static void schedule_group_clear(odp_schedule_group_t group) odp_thrmask_zero(&zero); if (group < 0 || group > ODP_SCHED_GROUP_CONTROL) - ODP_ABORT("Invalid scheduling group\n"); + _ODP_ABORT("Invalid scheduling group\n"); grp_update_mask(group, &zero); sched->sched_grp[group].allocated = 0; @@ -1277,7 +1277,7 @@ static inline int poll_pktin(uint32_t qi, int direct_recv, if (odp_unlikely(ret < 0)) num_enq = 0; - ODP_DBG("Dropped %i packets\n", num - num_enq); + _ODP_DBG("Dropped %i packets\n", num - num_enq); _odp_event_free_multi(&b_hdr[num_enq], num - num_enq); } @@ -1665,8 +1665,8 @@ static void schedule_order_lock(uint32_t lock_index) queue_index = sched_local.ordered.src_queue; - ODP_ASSERT(lock_index <= sched->queue[queue_index].order_lock_count && - !sched_local.ordered.lock_called.u8[lock_index]); + _ODP_ASSERT(lock_index <= sched->queue[queue_index].order_lock_count && + !sched_local.ordered.lock_called.u8[lock_index]); ord_lock = &sched->order[queue_index].lock[lock_index]; @@ -1694,11 +1694,11 @@ static void schedule_order_unlock(uint32_t lock_index) queue_index = sched_local.ordered.src_queue; - ODP_ASSERT(lock_index <= sched->queue[queue_index].order_lock_count); + _ODP_ASSERT(lock_index <= sched->queue[queue_index].order_lock_count); ord_lock = &sched->order[queue_index].lock[lock_index]; - ODP_ASSERT(sched_local.ordered.ctx == odp_atomic_load_u64(ord_lock)); + _ODP_ASSERT(sched_local.ordered.ctx == odp_atomic_load_u64(ord_lock)); odp_atomic_store_rel_u64(ord_lock, sched_local.ordered.ctx + 1); } @@ -1766,7 +1766,7 @@ static inline int threads_from_mask(int thr_tbl[], int count, const odp_thrmask_ for (i = 0; i < count; i++) { if (thr < 0) { - ODP_ERR("No more threads in the mask\n"); + _ODP_ERR("No more threads in the mask\n"); return -1; } @@ -1785,7 +1785,7 @@ static odp_schedule_group_t schedule_group_create(const char *name, count = odp_thrmask_count(mask); if (count < 0) { - ODP_ERR("Bad thread count\n"); + _ODP_ERR("Bad thread count\n"); return ODP_SCHED_GROUP_INVALID; } @@ -1826,7 +1826,7 @@ static int schedule_group_destroy(odp_schedule_group_t group) int i; if (group >= NUM_SCHED_GRPS || group < SCHED_GROUP_NAMED) { - ODP_ERR("Bad group %i\n", group); + _ODP_ERR("Bad group %i\n", group); return -1; } @@ -1836,7 +1836,7 @@ static int schedule_group_destroy(odp_schedule_group_t group) if (sched->sched_grp[group].allocated == 0) { odp_ticketlock_unlock(&sched->grp_lock); - ODP_ERR("Group not created: %i\n", group); + _ODP_ERR("Group not created: %i\n", group); return -1; } @@ -1876,13 +1876,13 @@ static int schedule_group_join(odp_schedule_group_t group, const odp_thrmask_t * odp_thrmask_t new_mask; if (group >= NUM_SCHED_GRPS || group < SCHED_GROUP_NAMED) { - ODP_ERR("Bad group %i\n", group); + _ODP_ERR("Bad group %i\n", group); return -1; } count = odp_thrmask_count(mask); if (count <= 0) { - ODP_ERR("No threads in the mask\n"); + _ODP_ERR("No threads in the mask\n"); return -1; } @@ -1891,7 +1891,7 @@ static int schedule_group_join(odp_schedule_group_t group, const odp_thrmask_t * thr = odp_thrmask_first(mask); for (i = 0; i < count; i++) { if (thr < 0) { - ODP_ERR("No more threads in the mask\n"); + _ODP_ERR("No more threads in the mask\n"); return -1; } @@ -1903,7 +1903,7 @@ static int schedule_group_join(odp_schedule_group_t group, const odp_thrmask_t * if (sched->sched_grp[group].allocated == 0) { odp_ticketlock_unlock(&sched->grp_lock); - ODP_ERR("Bad group status\n"); + _ODP_ERR("Bad group status\n"); return -1; } @@ -1922,13 +1922,13 @@ static int schedule_group_leave(odp_schedule_group_t group, const odp_thrmask_t odp_thrmask_t new_mask; if (group >= NUM_SCHED_GRPS || group < SCHED_GROUP_NAMED) { - ODP_ERR("Bad group %i\n", group); + _ODP_ERR("Bad group %i\n", group); return -1; } count = odp_thrmask_count(mask); if (count <= 0) { - ODP_ERR("No threads in the mask\n"); + _ODP_ERR("No threads in the mask\n"); return -1; } @@ -1937,7 +1937,7 @@ static int schedule_group_leave(odp_schedule_group_t group, const odp_thrmask_t thr = odp_thrmask_first(mask); for (i = 0; i < count; i++) { if (thr < 0) { - ODP_ERR("No more threads in the mask\n"); + _ODP_ERR("No more threads in the mask\n"); return -1; } @@ -1951,7 +1951,7 @@ static int schedule_group_leave(odp_schedule_group_t group, const odp_thrmask_t if (sched->sched_grp[group].allocated == 0) { odp_ticketlock_unlock(&sched->grp_lock); - ODP_ERR("Bad group status\n"); + _ODP_ERR("Bad group status\n"); return -1; } @@ -2099,14 +2099,14 @@ static void schedule_print(void) (void)schedule_capability(&capa); - ODP_PRINT("\nScheduler debug info\n"); - ODP_PRINT("--------------------\n"); - ODP_PRINT(" scheduler: basic\n"); - ODP_PRINT(" max groups: %u\n", capa.max_groups); - ODP_PRINT(" max priorities: %u\n", capa.max_prios); - ODP_PRINT(" num spread: %i\n", num_spread); - ODP_PRINT(" prefer ratio: %u\n", sched->config.prefer_ratio); - ODP_PRINT("\n"); + _ODP_PRINT("\nScheduler debug info\n"); + _ODP_PRINT("--------------------\n"); + _ODP_PRINT(" scheduler: basic\n"); + _ODP_PRINT(" max groups: %u\n", capa.max_groups); + _ODP_PRINT(" max priorities: %u\n", capa.max_prios); + _ODP_PRINT(" num spread: %i\n", num_spread); + _ODP_PRINT(" prefer ratio: %u\n", sched->config.prefer_ratio); + _ODP_PRINT("\n"); pos = 0; pos += _odp_snprint(&str[pos], size - pos, " Number of active event queues:\n"); @@ -2116,7 +2116,7 @@ static void schedule_print(void) for (spr = 0; spr < num_spread; spr++) pos += _odp_snprint(&str[pos], size - pos, " %7i", spr); - ODP_PRINT("%s\n", str); + _ODP_PRINT("%s\n", str); for (prio = 0; prio < NUM_PRIO; prio++) { for (grp = 0; grp < NUM_SCHED_GRPS; grp++) @@ -2126,7 +2126,7 @@ static void schedule_print(void) if (grp == NUM_SCHED_GRPS) continue; - ODP_PRINT(" prio: %i\n", prio); + _ODP_PRINT(" prio: %i\n", prio); for (grp = 0; grp < NUM_SCHED_GRPS; grp++) { if (sched->sched_grp[grp].allocated == 0) @@ -2143,12 +2143,12 @@ static void schedule_print(void) num_active, num_queues); } - ODP_PRINT("%s\n", str); + _ODP_PRINT("%s\n", str); } } - ODP_PRINT("\n Number of threads per schedule group:\n"); - ODP_PRINT(" name spread\n"); + _ODP_PRINT("\n Number of threads per schedule group:\n"); + _ODP_PRINT(" name spread\n"); for (grp = 0; grp < NUM_SCHED_GRPS; grp++) { if (sched->sched_grp[grp].allocated == 0) @@ -2162,10 +2162,10 @@ static void schedule_print(void) pos += _odp_snprint(&str[pos], size - pos, " %u", sched->sched_grp[grp].spread_thrs[spr]); - ODP_PRINT("%s\n", str); + _ODP_PRINT("%s\n", str); } - ODP_PRINT("\n"); + _ODP_PRINT("\n"); } /* Returns spread for queue debug prints */ diff --git a/platform/linux-generic/odp_schedule_if.c b/platform/linux-generic/odp_schedule_if.c index 564153137..940162e92 100644 --- a/platform/linux-generic/odp_schedule_if.c +++ b/platform/linux-generic/odp_schedule_if.c @@ -51,7 +51,7 @@ int odp_schedule_config(const odp_schedule_config_t *config) odp_schedule_config_t defconfig; if (odp_global_rw->schedule_configured) { - ODP_ERR("Scheduler has been configured already\n"); + _ODP_ERR("Scheduler has been configured already\n"); return -1; } @@ -70,7 +70,7 @@ int odp_schedule_config(const odp_schedule_config_t *config) odp_event_t odp_schedule(odp_queue_t *from, uint64_t wait) { - ODP_ASSERT(odp_global_rw->schedule_configured); + _ODP_ASSERT(odp_global_rw->schedule_configured); return _odp_sched_api->schedule(from, wait); } @@ -78,7 +78,7 @@ odp_event_t odp_schedule(odp_queue_t *from, uint64_t wait) int odp_schedule_multi(odp_queue_t *from, uint64_t wait, odp_event_t events[], int num) { - ODP_ASSERT(odp_global_rw->schedule_configured); + _ODP_ASSERT(odp_global_rw->schedule_configured); return _odp_sched_api->schedule_multi(from, wait, events, num); } @@ -220,7 +220,7 @@ int _odp_schedule_init_global(void) if (sched == NULL || !strcmp(sched, "default")) sched = _ODP_SCHEDULE_DEFAULT; - ODP_PRINT("Using scheduler '%s'\n", sched); + _ODP_PRINT("Using scheduler '%s'\n", sched); if (!strcmp(sched, "basic")) { _odp_sched_id = _ODP_SCHED_ID_BASIC; @@ -235,7 +235,7 @@ int _odp_schedule_init_global(void) _odp_sched_fn = &_odp_schedule_scalable_fn; _odp_sched_api = &_odp_schedule_scalable_api; } else { - ODP_ABORT("Unknown scheduler specified via ODP_SCHEDULER\n"); + _ODP_ABORT("Unknown scheduler specified via ODP_SCHEDULER\n"); return -1; } diff --git a/platform/linux-generic/odp_schedule_scalable.c b/platform/linux-generic/odp_schedule_scalable.c index 08f19c4e5..faf5d4288 100644 --- a/platform/linux-generic/odp_schedule_scalable.c +++ b/platform/linux-generic/odp_schedule_scalable.c @@ -79,7 +79,7 @@ static int thread_state_init(int tidx) sched_scalable_thread_state_t *ts; uint32_t i; - ODP_ASSERT(tidx < MAXTHREADS); + _ODP_ASSERT(tidx < MAXTHREADS); ts = &global->thread_state[tidx]; ts->atomq = NULL; ts->src_schedq = NULL; @@ -123,7 +123,7 @@ static void insert_schedq_in_list(sched_scalable_thread_state_t *ts, } } if (ts->num_schedq == SCHEDQ_PER_THREAD) - ODP_ABORT("Too many schedqs\n"); + _ODP_ABORT("Too many schedqs\n"); ts->schedq_list[ts->num_schedq++] = schedq; } @@ -139,7 +139,7 @@ static void remove_schedq_from_list(sched_scalable_thread_state_t *ts, ts->num_schedq--; return; } - ODP_ABORT("Cannot find schedq\n"); + _ODP_ABORT("Cannot find schedq\n"); } /******************************************************************************* @@ -319,7 +319,7 @@ sched_update_deq(sched_elem_t *q, */ oss = q->qschst; do { - ODP_ASSERT(oss.cur_ticket == _odp_sched_ts->ticket); + _ODP_ASSERT(oss.cur_ticket == _odp_sched_ts->ticket); nss = oss; nss.numevts -= actual; if (nss.numevts > 0 && !pushed) { @@ -361,7 +361,7 @@ sched_update_deq(sched_elem_t *q, true, __ATOMIC_RELAXED, __ATOMIC_RELAXED)); if (odp_unlikely(ticket != TICKET_INVALID)) { - ODP_ASSERT(q->qschst_type != ODP_SCHED_SYNC_ATOMIC); + _ODP_ASSERT(q->qschst_type != ODP_SCHED_SYNC_ATOMIC); /* Wait for our turn to update schedq. */ if (odp_unlikely(__atomic_load_n(&q->qschst.cur_ticket, __ATOMIC_ACQUIRE) != ticket)) { @@ -421,8 +421,8 @@ sched_update_deq_sc(sched_elem_t *q, uint32_t ticket; if (atomic) { - ODP_ASSERT(q->qschst.cur_ticket == _odp_sched_ts->ticket); - ODP_ASSERT(q->qschst.cur_ticket != q->qschst.nxt_ticket); + _ODP_ASSERT(q->qschst.cur_ticket == _odp_sched_ts->ticket); + _ODP_ASSERT(q->qschst.cur_ticket != q->qschst.nxt_ticket); q->qschst.numevts -= actual; q->qschst.cur_ticket = _odp_sched_ts->ticket + 1; if (q->qschst.numevts > 0) @@ -528,9 +528,9 @@ sched_queue_t *_odp_sched_queue_add(odp_schedule_group_t grp, uint32_t prio) sched_group_t *sg; uint32_t x; - ODP_ASSERT(grp >= 0 && grp < (odp_schedule_group_t)MAX_SCHED_GROUP); - ODP_ASSERT((global->sg_free & (1ULL << grp)) == 0); - ODP_ASSERT(prio < ODP_SCHED_PRIO_NUM); + _ODP_ASSERT(grp >= 0 && grp < (odp_schedule_group_t)MAX_SCHED_GROUP); + _ODP_ASSERT((global->sg_free & (1ULL << grp)) == 0); + _ODP_ASSERT(prio < ODP_SCHED_PRIO_NUM); sgi = grp; sg = global->sg_vec[sgi]; @@ -554,9 +554,9 @@ static uint32_t sched_pktin_add(odp_schedule_group_t grp, uint32_t prio) uint32_t sgi; sched_group_t *sg; - ODP_ASSERT(grp >= 0 && grp < (odp_schedule_group_t)MAX_SCHED_GROUP); - ODP_ASSERT((global->sg_free & (1ULL << grp)) == 0); - ODP_ASSERT(prio < ODP_SCHED_PRIO_NUM); + _ODP_ASSERT(grp >= 0 && grp < (odp_schedule_group_t)MAX_SCHED_GROUP); + _ODP_ASSERT((global->sg_free & (1ULL << grp)) == 0); + _ODP_ASSERT(prio < ODP_SCHED_PRIO_NUM); sgi = grp; sg = global->sg_vec[sgi]; @@ -589,9 +589,9 @@ void _odp_sched_queue_rem(odp_schedule_group_t grp, uint32_t prio) sched_group_t *sg; uint32_t x; - ODP_ASSERT(grp >= 0 && grp < (odp_schedule_group_t)MAX_SCHED_GROUP); - ODP_ASSERT((global->sg_free & (1ULL << grp)) == 0); - ODP_ASSERT(prio < ODP_SCHED_PRIO_NUM); + _ODP_ASSERT(grp >= 0 && grp < (odp_schedule_group_t)MAX_SCHED_GROUP); + _ODP_ASSERT((global->sg_free & (1ULL << grp)) == 0); + _ODP_ASSERT(prio < ODP_SCHED_PRIO_NUM); sgi = grp; sg = global->sg_vec[sgi]; @@ -685,8 +685,8 @@ static inline void _schedule_release_atomic(sched_scalable_thread_state_t *ts) { #ifdef CONFIG_QSCHST_LOCK sched_update_deq_sc(ts->atomq, ts->dequeued, true); - ODP_ASSERT(ts->atomq->qschst.cur_ticket != ts->ticket); - ODP_ASSERT(ts->atomq->qschst.cur_ticket == + _ODP_ASSERT(ts->atomq->qschst.cur_ticket != ts->ticket); + _ODP_ASSERT(ts->atomq->qschst.cur_ticket == ts->atomq->qschst.nxt_ticket); #else sched_update_deq(ts->atomq, ts->dequeued, true); @@ -711,10 +711,10 @@ static void pktio_start(int pktio_idx, queue_entry_t *qentry; sched_elem_t *elem; - ODP_ASSERT(pktio_idx < ODP_CONFIG_PKTIO_ENTRIES); + _ODP_ASSERT(pktio_idx < ODP_CONFIG_PKTIO_ENTRIES); for (i = 0; i < num_in_queue; i++) { rxq = in_queue_idx[i]; - ODP_ASSERT(rxq < PKTIO_MAX_QUEUES); + _ODP_ASSERT(rxq < PKTIO_MAX_QUEUES); __atomic_fetch_add(&global->poll_count[pktio_idx], 1, __ATOMIC_RELAXED); qentry = _odp_qentry_from_ext(odpq[i]); @@ -723,7 +723,7 @@ static void pktio_start(int pktio_idx, elem->pktio_idx = pktio_idx; elem->rx_queue = rxq; elem->xoffset = sched_pktin_add(elem->sched_grp, elem->sched_prio); - ODP_ASSERT(elem->schedq != NULL); + _ODP_ASSERT(elem->schedq != NULL); schedq_push(elem->schedq, elem); } } @@ -780,7 +780,7 @@ static int poll_pktin(sched_elem_t *elem, odp_event_t ev[], int num_evts) if (is_ordered(elem)) { /* Need reorder context and slot in reorder window */ rwin = queue_get_rwin((queue_entry_t *)elem); - ODP_ASSERT(rwin != NULL); + _ODP_ASSERT(rwin != NULL); if (odp_unlikely(!have_reorder_ctx(ts) || !_odp_rwin_reserve_sc(rwin, &sn))) { /* Put back queue on source schedq */ @@ -831,7 +831,7 @@ events_dequeued: /* Events remain, enqueue them */ i = _odp_queue_enq_sp(elem, &rx_evts[num], num_rx - num); /* Enqueue must succeed as the queue was empty */ - ODP_ASSERT(i == num_rx - num); + _ODP_ASSERT(i == num_rx - num); } goto events_dequeued; } @@ -858,9 +858,9 @@ events_dequeued: /* Don't push queue to schedq */ } - ODP_ASSERT(ts->atomq == NULL); - ODP_ASSERT(!ts->out_of_order); - ODP_ASSERT(ts->rctx == NULL); + _ODP_ASSERT(ts->atomq == NULL); + _ODP_ASSERT(!ts->out_of_order); + _ODP_ASSERT(ts->rctx == NULL); return 0; } @@ -883,7 +883,7 @@ static int _schedule(odp_queue_t *from, odp_event_t ev[], int num_evts) if (atomq != NULL && is_pktin(atomq)) { /* Atomic pktin queue */ if (ts->dequeued < atomq->qschst.wrr_budget) { - ODP_ASSERT(ts->src_schedq != NULL); + _ODP_ASSERT(ts->src_schedq != NULL); num = poll_pktin(atomq, ev, num_evts); if (odp_likely(num != 0)) { if (from) @@ -896,13 +896,13 @@ static int _schedule(odp_queue_t *from, odp_event_t ev[], int num_evts) } ts->atomq = NULL; } else if (atomq != NULL) { - ODP_ASSERT(ts->ticket != TICKET_INVALID); + _ODP_ASSERT(ts->ticket != TICKET_INVALID); #ifdef CONFIG_QSCHST_LOCK LOCK(&atomq->qschlock); #endif dequeue_atomic: - ODP_ASSERT(ts->ticket == atomq->qschst.cur_ticket); - ODP_ASSERT(ts->ticket != atomq->qschst.nxt_ticket); + _ODP_ASSERT(ts->ticket == atomq->qschst.cur_ticket); + _ODP_ASSERT(ts->ticket != atomq->qschst.nxt_ticket); /* Atomic queues can be dequeued without lock since this thread * has the only reference to the atomic queue being processed. */ @@ -985,7 +985,7 @@ restart_same: #ifdef CONFIG_QSCHST_LOCK LOCK(&atomq->qschlock); ts->ticket = atomq->qschst.nxt_ticket++; - ODP_ASSERT(atomq->qschst.cur_ticket == ts->ticket); + _ODP_ASSERT(atomq->qschst.cur_ticket == ts->ticket); #else /* Dequeued atomic queue from the schedq, only we * can process it and any qschst updates are our @@ -1045,7 +1045,7 @@ restart_same: * Allocate a slot in the reorder window. */ rwin = queue_get_rwin((queue_entry_t *)elem); - ODP_ASSERT(rwin != NULL); + _ODP_ASSERT(rwin != NULL); if (odp_unlikely(!_odp_rwin_reserve(rwin, &sn))) { /* Reorder window full */ /* Look at next schedq, find other queue */ @@ -1107,7 +1107,7 @@ restart_same: * inserted into the reorder window. */ _odp_rctx_release(rctx); - ODP_ASSERT(ts->rctx == NULL); + _ODP_ASSERT(ts->rctx == NULL); } /* Dequeue from parallel/ordered queue failed * Check if we have a queue at the head of the schedq that needs @@ -1137,7 +1137,7 @@ static void schedule_order_lock(uint32_t lock_index) if (odp_unlikely(rctx == NULL || rctx->rwin == NULL || lock_index >= rctx->rwin->lock_count)) { - ODP_ERR("Invalid call to odp_schedule_order_lock\n"); + _ODP_ERR("Invalid call to odp_schedule_order_lock\n"); return; } if (odp_unlikely(__atomic_load_n(&rctx->rwin->olock[lock_index], @@ -1159,7 +1159,7 @@ static void schedule_order_unlock(uint32_t lock_index) rctx->rwin == NULL || lock_index >= rctx->rwin->lock_count || rctx->rwin->olock[lock_index] != rctx->sn)) { - ODP_ERR("Invalid call to odp_schedule_order_unlock\n"); + _ODP_ERR("Invalid call to odp_schedule_order_unlock\n"); return; } atomic_store_release(&rctx->rwin->olock[lock_index], @@ -1456,7 +1456,7 @@ static odp_schedule_group_t schedule_group_create(const char *name, /* Validate inputs */ if (mask == NULL) - ODP_ABORT("mask is NULL\n"); + _ODP_ABORT("mask is NULL\n"); odp_spinlock_lock(&global->sched_grp_lock); @@ -1570,12 +1570,12 @@ static int schedule_group_destroy(odp_schedule_group_t group) /* Check if all threads/queues have left the group */ for (p = 0; p < ODP_SCHED_PRIO_NUM; p++) { if (!bitset_is_null(sg->thr_actual[p])) { - ODP_ERR("Group has threads\n"); + _ODP_ERR("Group has threads\n"); ret = -1; goto thrd_q_present_in_group; } if (p != ODP_SCHED_PRIO_PKTIN && sg->xcount[p] != 0) { - ODP_ERR("Group has queues\n"); + _ODP_ERR("Group has queues\n"); ret = -1; goto thrd_q_present_in_group; } @@ -1606,7 +1606,7 @@ static odp_schedule_group_t schedule_group_lookup(const char *name) /* Validate inputs */ if (name == NULL) - ODP_ABORT("name or mask is NULL\n"); + _ODP_ABORT("name or mask is NULL\n"); group = ODP_SCHED_GROUP_INVALID; @@ -1639,7 +1639,7 @@ static int schedule_group_join(odp_schedule_group_t group, return -1; if (mask == NULL) - ODP_ABORT("name or mask is NULL\n"); + _ODP_ABORT("name or mask is NULL\n"); odp_spinlock_lock(&global->sched_grp_lock); @@ -1671,7 +1671,7 @@ static int schedule_group_leave(odp_schedule_group_t group, } if (mask == NULL) - ODP_ABORT("name or mask is NULL\n"); + _ODP_ABORT("name or mask is NULL\n"); odp_spinlock_lock(&global->sched_grp_lock); @@ -1710,7 +1710,7 @@ static int schedule_group_thrmask(odp_schedule_group_t group, } if (mask == NULL) - ODP_ABORT("name or mask is NULL\n"); + _ODP_ABORT("name or mask is NULL\n"); odp_spinlock_lock(&global->sched_grp_lock); @@ -1748,7 +1748,7 @@ static int schedule_group_info(odp_schedule_group_t group, } if (info == NULL) - ODP_ABORT("name or mask is NULL\n"); + _ODP_ABORT("name or mask is NULL\n"); odp_spinlock_lock(&global->sched_grp_lock); @@ -1794,7 +1794,7 @@ static int schedule_init_global(void) global = odp_shm_addr(shm); if (global == NULL) { - ODP_ERR("Schedule init: Shm reserve failed.\n"); + _ODP_ERR("Schedule init: Shm reserve failed.\n"); return -1; } @@ -1817,7 +1817,7 @@ static int schedule_init_global(void) pool = _odp_ishm_pool_create("sched_shm_pool", pool_size, min_alloc, max_alloc, 0); if (pool == NULL) { - ODP_ERR("Failed to allocate shared memory pool " + _ODP_ERR("Failed to allocate shared memory pool " "for sched\n"); goto failed_sched_shm_pool_create; } @@ -1846,19 +1846,19 @@ static int schedule_init_global(void) odp_thrmask_zero(&mask); tmp_all = odp_schedule_group_create("__group_all", &mask); if (tmp_all != ODP_SCHED_GROUP_ALL) { - ODP_ERR("Could not create ODP_SCHED_GROUP_ALL()\n"); + _ODP_ERR("Could not create ODP_SCHED_GROUP_ALL()\n"); goto failed_create_group_all; } tmp_wrkr = odp_schedule_group_create("__group_worker", &mask); if (tmp_wrkr != ODP_SCHED_GROUP_WORKER) { - ODP_ERR("Could not create ODP_SCHED_GROUP_WORKER()\n"); + _ODP_ERR("Could not create ODP_SCHED_GROUP_WORKER()\n"); goto failed_create_group_worker; } tmp_ctrl = odp_schedule_group_create("__group_control", &mask); if (tmp_ctrl != ODP_SCHED_GROUP_CONTROL) { - ODP_ERR("Could not create ODP_SCHED_GROUP_CONTROL()\n"); + _ODP_ERR("Could not create ODP_SCHED_GROUP_CONTROL()\n"); goto failed_create_group_control; } @@ -1891,21 +1891,21 @@ static int schedule_term_global(void) * GROUP_CONTROL groups. */ if (global->config_if.group_enable.all) { if (odp_schedule_group_destroy(ODP_SCHED_GROUP_ALL) != 0) - ODP_ERR("Failed to destroy ODP_SCHED_GROUP_ALL\n"); + _ODP_ERR("Failed to destroy ODP_SCHED_GROUP_ALL\n"); } if (global->config_if.group_enable.worker) { if (odp_schedule_group_destroy(ODP_SCHED_GROUP_WORKER) != 0) - ODP_ERR("Failed to destroy ODP_SCHED_GROUP_WORKER\n"); + _ODP_ERR("Failed to destroy ODP_SCHED_GROUP_WORKER\n"); } if (global->config_if.group_enable.control) { if (odp_schedule_group_destroy(ODP_SCHED_GROUP_CONTROL) != 0) - ODP_ERR("Failed to destroy ODP_SCHED_GROUP_CONTROL\n"); + _ODP_ERR("Failed to destroy ODP_SCHED_GROUP_CONTROL\n"); } _odp_ishm_pool_destroy(global->sched_shm_pool); if (odp_shm_free(global->shm)) { - ODP_ERR("Shm free failed for scalable scheduler"); + _ODP_ERR("Shm free failed for scalable scheduler"); return -1; } @@ -1931,21 +1931,21 @@ static int schedule_init_local(void) if (global->config_if.group_enable.all) { if (odp_schedule_group_join(ODP_SCHED_GROUP_ALL, &mask) != 0) { - ODP_ERR("Failed to join ODP_SCHED_GROUP_ALL\n"); + _ODP_ERR("Failed to join ODP_SCHED_GROUP_ALL\n"); goto failed_to_join_grp_all; } } if (global->config_if.group_enable.control && thr_type == ODP_THREAD_CONTROL) { if (odp_schedule_group_join(ODP_SCHED_GROUP_CONTROL, &mask) != 0) { - ODP_ERR("Failed to join ODP_SCHED_GROUP_CONTROL\n"); + _ODP_ERR("Failed to join ODP_SCHED_GROUP_CONTROL\n"); goto failed_to_join_grp_ctrl; } } if (global->config_if.group_enable.worker && thr_type == ODP_THREAD_WORKER) { if (odp_schedule_group_join(ODP_SCHED_GROUP_WORKER, &mask) != 0) { - ODP_ERR("Failed to join ODP_SCHED_GROUP_WORKER\n"); + _ODP_ERR("Failed to join ODP_SCHED_GROUP_WORKER\n"); goto failed_to_join_grp_wrkr; } } @@ -1981,25 +1981,24 @@ static int schedule_term_local(void) if (global->config_if.group_enable.all) { if (odp_schedule_group_leave(ODP_SCHED_GROUP_ALL, &mask) != 0) - ODP_ERR("Failed to leave ODP_SCHED_GROUP_ALL\n"); + _ODP_ERR("Failed to leave ODP_SCHED_GROUP_ALL\n"); } if (global->config_if.group_enable.control && thr_type == ODP_THREAD_CONTROL) { if (odp_schedule_group_leave(ODP_SCHED_GROUP_CONTROL, &mask) != 0) - ODP_ERR("Failed to leave ODP_SCHED_GROUP_CONTROL\n"); + _ODP_ERR("Failed to leave ODP_SCHED_GROUP_CONTROL\n"); } if (global->config_if.group_enable.worker && thr_type == ODP_THREAD_WORKER) { if (odp_schedule_group_leave(ODP_SCHED_GROUP_WORKER, &mask) != 0) - ODP_ERR("Failed to leave ODP_SCHED_GROUP_WORKER\n"); + _ODP_ERR("Failed to leave ODP_SCHED_GROUP_WORKER\n"); } update_sg_membership(_odp_sched_ts); /* Check if the thread is still part of any groups */ if (_odp_sched_ts->num_schedq != 0) { - ODP_ERR("Thread %d still part of scheduler group(s)\n", - _odp_sched_ts->tidx); + _ODP_ERR("Thread %d still part of scheduler group(s)\n", _odp_sched_ts->tidx); rc = -1; } @@ -2026,16 +2025,16 @@ static int schedule_config(const odp_schedule_config_t *config) /* Destroy disabled predefined scheduling groups. */ if (!config->sched_group.all) { if (odp_schedule_group_destroy(ODP_SCHED_GROUP_ALL) != 0) - ODP_ERR("Failed to destroy ODP_SCHED_GROUP_ALL\n"); + _ODP_ERR("Failed to destroy ODP_SCHED_GROUP_ALL\n"); } if (!config->sched_group.worker) { if (odp_schedule_group_destroy(ODP_SCHED_GROUP_WORKER) != 0) - ODP_ERR("Failed to destroy ODP_SCHED_GROUP_WORKER\n"); + _ODP_ERR("Failed to destroy ODP_SCHED_GROUP_WORKER\n"); } if (!config->sched_group.control) { if (odp_schedule_group_destroy(ODP_SCHED_GROUP_CONTROL) != 0) - ODP_ERR("Failed to destroy ODP_SCHED_GROUP_CONTROL\n"); + _ODP_ERR("Failed to destroy ODP_SCHED_GROUP_CONTROL\n"); } odp_spinlock_unlock(&global->init_lock); @@ -2131,7 +2130,7 @@ static void order_lock(void) * We are in-order when our reorder window slot number (sn) * equals the head of the reorder window. */ - ODP_ASSERT(ts->rctx != NULL); + _ODP_ASSERT(ts->rctx != NULL); rwin = ts->rctx->rwin; sn = ts->rctx->sn; sevl(); @@ -2178,12 +2177,12 @@ static void schedule_print(void) (void)schedule_capability(&capa); - ODP_PRINT("\nScheduler debug info\n"); - ODP_PRINT("--------------------\n"); - ODP_PRINT(" scheduler: scalable\n"); - ODP_PRINT(" max groups: %u\n", capa.max_groups); - ODP_PRINT(" max priorities: %u\n", capa.max_prios); - ODP_PRINT("\n"); + _ODP_PRINT("\nScheduler debug info\n"); + _ODP_PRINT("--------------------\n"); + _ODP_PRINT(" scheduler: scalable\n"); + _ODP_PRINT(" max groups: %u\n", capa.max_groups); + _ODP_PRINT(" max priorities: %u\n", capa.max_prios); + _ODP_PRINT("\n"); } const schedule_fn_t _odp_schedule_scalable_fn = { diff --git a/platform/linux-generic/odp_schedule_scalable_ordered.c b/platform/linux-generic/odp_schedule_scalable_ordered.c index 54181f10f..f6655d7fa 100644 --- a/platform/linux-generic/odp_schedule_scalable_ordered.c +++ b/platform/linux-generic/odp_schedule_scalable_ordered.c @@ -97,7 +97,7 @@ bool _odp_rwin_reserve_sc(reorder_window_t *rwin, uint32_t *sn) void _odp_rwin_unreserve_sc(reorder_window_t *rwin, uint32_t sn) { - ODP_ASSERT(rwin->tail == sn + 1); + _ODP_ASSERT(rwin->tail == sn + 1); rwin->tail = sn; } @@ -117,7 +117,7 @@ static void rwin_insert(reorder_window_t *rwin, /* We are out-of-order. Store context in reorder window, * releasing its content. */ - ODP_ASSERT(rwin->ring[sn & winmask] == NULL); + _ODP_ASSERT(rwin->ring[sn & winmask] == NULL); atomic_store_release(&rwin->ring[sn & winmask], rctx, /*readonly=*/false); @@ -147,7 +147,7 @@ static void rwin_insert(reorder_window_t *rwin, } /* old.head == sn => we are now in-order! */ - ODP_ASSERT(old.head == sn); + _ODP_ASSERT(old.head == sn); /* We are in-order so our responsibility to retire contexts */ new.head = old.head; new.chgi = old.chgi + 1; @@ -191,7 +191,7 @@ void _odp_rctx_init(reorder_context_t *rctx, uint16_t idx, /* rctx->rvec_free and rctx->idx already initialised in * thread_state_init function. */ - ODP_ASSERT(rctx->idx == idx); + _ODP_ASSERT(rctx->idx == idx); rctx->rwin = rwin; rctx->sn = sn; rctx->olock_flags = 0; @@ -210,7 +210,7 @@ static inline void rctx_free(const reorder_context_t *rctx) next_idx = rctx->next_idx; - ODP_ASSERT(rctx->rwin != NULL); + _ODP_ASSERT(rctx->rwin != NULL); /* Set free bit */ if (rctx->rvec_free == &_odp_sched_ts->rvec_free) /* Since it is our own reorder context, we can instead @@ -266,7 +266,7 @@ static void blocking_enqueue(queue_entry_t *q, _odp_event_hdr_t **evts, int num) /* Attempt to enqueue remaining events */ actual = q->enqueue_multi(qentry_to_int(q), evts, num); if (odp_unlikely(actual < 0)) - ODP_ERR("Failed to enqueue deferred events\n"); + _ODP_ERR("Failed to enqueue deferred events\n"); /* Update for potential partial success */ evts += actual; num -= actual; @@ -327,7 +327,7 @@ int _odp_rctx_save(queue_entry_t *queue, _odp_event_hdr_t *event_hdr[], int num) ts = _odp_sched_ts; first = ts->rctx; - ODP_ASSERT(ts->rctx != NULL); + _ODP_ASSERT(ts->rctx != NULL); cur = &first[(int)first->cur_idx - (int)first->idx]; for (i = 0; i < num; i++) { if (odp_unlikely(cur->numevts == RC_EVT_SIZE)) { diff --git a/platform/linux-generic/odp_schedule_sp.c b/platform/linux-generic/odp_schedule_sp.c index 4c4034782..74b805e79 100644 --- a/platform/linux-generic/odp_schedule_sp.c +++ b/platform/linux-generic/odp_schedule_sp.c @@ -171,7 +171,7 @@ static int init_global(void) odp_shm_t shm; sched_group_t *sched_group = NULL; - ODP_DBG("Using SP scheduler\n"); + _ODP_DBG("Using SP scheduler\n"); shm = odp_shm_reserve("_odp_sched_sp_global", sizeof(sched_global_t), @@ -180,7 +180,7 @@ static int init_global(void) sched_global = odp_shm_addr(shm); if (sched_global == NULL) { - ODP_ERR("Schedule init: Shm reserve failed.\n"); + _ODP_ERR("Schedule init: Shm reserve failed.\n"); return -1; } @@ -252,7 +252,7 @@ static int term_global(void) if (sched_global->queue_cmd[qi].init) { while (_odp_sched_queue_deq(qi, &event, 1, 1) > 0) { if (report) { - ODP_ERR("Queue not empty\n"); + _ODP_ERR("Queue not empty\n"); report = 0; } odp_event_free(event); @@ -262,7 +262,7 @@ static int term_global(void) ret = odp_shm_free(sched_global->shm); if (ret < 0) { - ODP_ERR("Shm free failed for sp_scheduler"); + _ODP_ERR("Shm free failed for sp_scheduler"); ret = -1; } @@ -290,7 +290,7 @@ static void schedule_group_clear(odp_schedule_group_t group) const odp_thrmask_t *thrmask; if (group < 0 || group >= NUM_STATIC_GROUP) - ODP_ABORT("Invalid scheduling group\n"); + _ODP_ABORT("Invalid scheduling group\n"); thrmask = &sched_group->s.group[group].mask; @@ -356,7 +356,7 @@ static void remove_group(sched_group_t *sched_group, int thr, int group) /* Extra array bounds check to suppress warning on GCC 7.4 with -O3 */ if (num >= NUM_GROUP) { - ODP_ERR("Too many groups"); + _ODP_ERR("Too many groups"); return; } @@ -440,7 +440,7 @@ static int create_queue(uint32_t qi, const odp_schedule_param_t *sched_param) int prio = 0; if (odp_global_rw->schedule_configured == 0) { - ODP_ERR("Scheduler has not been configured\n"); + _ODP_ERR("Scheduler has not been configured\n"); return -1; } @@ -527,14 +527,12 @@ static void pktio_start(int pktio_index, int i; sched_cmd_t *cmd; - ODP_DBG("pktio index: %i, %i pktin queues %i\n", - pktio_index, num, pktin_idx[0]); + _ODP_DBG("pktio index: %i, %i pktin queues %i\n", pktio_index, num, pktin_idx[0]); cmd = &sched_global->pktio_cmd[pktio_index]; if (num > NUM_PKTIN) - ODP_ABORT("Supports only %i pktin queues per interface\n", - NUM_PKTIN); + _ODP_ABORT("Supports only %i pktin queues per interface\n", NUM_PKTIN); for (i = 0; i < num; i++) { cmd->pktin_idx[i] = pktin_idx[i]; @@ -607,7 +605,7 @@ static inline void enqueue_packets(odp_queue_t queue, if (num_enq < num_pkt) { num_drop = num_pkt - num_enq; - ODP_DBG("Dropped %i packets\n", num_drop); + _ODP_DBG("Dropped %i packets\n", num_drop); odp_packet_free_multi((odp_packet_t *)&hdr_tbl[num_enq], num_drop); } @@ -1046,12 +1044,12 @@ static void schedule_print(void) (void)schedule_capability(&capa); - ODP_PRINT("\nScheduler debug info\n"); - ODP_PRINT("--------------------\n"); - ODP_PRINT(" scheduler: sp\n"); - ODP_PRINT(" max groups: %u\n", capa.max_groups); - ODP_PRINT(" max priorities: %u\n", capa.max_prios); - ODP_PRINT("\n"); + _ODP_PRINT("\nScheduler debug info\n"); + _ODP_PRINT("--------------------\n"); + _ODP_PRINT(" scheduler: sp\n"); + _ODP_PRINT(" max groups: %u\n", capa.max_groups); + _ODP_PRINT(" max priorities: %u\n", capa.max_prios); + _ODP_PRINT("\n"); } static void get_config(schedule_config_t *config) diff --git a/platform/linux-generic/odp_shared_memory.c b/platform/linux-generic/odp_shared_memory.c index 74e5c9864..4103568a7 100644 --- a/platform/linux-generic/odp_shared_memory.c +++ b/platform/linux-generic/odp_shared_memory.c @@ -72,7 +72,7 @@ odp_shm_t odp_shm_reserve(const char *name, uint64_t size, uint64_t align, uint32_t supported_flgs = SUPPORTED_SHM_FLAGS; if (flags & ~supported_flgs) { - ODP_ERR("Unsupported SHM flag\n"); + _ODP_ERR("Unsupported SHM flag\n"); return ODP_SHM_INVALID; } diff --git a/platform/linux-generic/odp_sorted_list.c b/platform/linux-generic/odp_sorted_list.c index 8f998238d..1091b7415 100644 --- a/platform/linux-generic/odp_sorted_list.c +++ b/platform/linux-generic/odp_sorted_list.c @@ -262,12 +262,12 @@ void _odp_sorted_list_stats_print(_odp_int_sorted_pool_t sorted_pool) sorted_pool_t *pool; pool = (sorted_pool_t *)(uintptr_t)sorted_pool; - ODP_PRINT("sorted_pool=0x%" PRIX64 "\n", sorted_pool); - ODP_PRINT(" max_sorted_lists=%u next_list_idx=%u\n", - pool->max_sorted_lists, pool->next_list_idx); - ODP_PRINT(" total_inserts=%" PRIu64 " total_deletes=%" PRIu64 - " total_removes=%" PRIu64 "\n", pool->total_inserts, - pool->total_deletes, pool->total_removes); + _ODP_PRINT("sorted_pool=0x%" PRIX64 "\n", sorted_pool); + _ODP_PRINT(" max_sorted_lists=%u next_list_idx=%u\n", + pool->max_sorted_lists, pool->next_list_idx); + _ODP_PRINT(" total_inserts=%" PRIu64 " total_deletes=%" PRIu64 + " total_removes=%" PRIu64 "\n", pool->total_inserts, + pool->total_deletes, pool->total_removes); } void _odp_sorted_pool_destroy(_odp_int_sorted_pool_t sorted_pool) diff --git a/platform/linux-generic/odp_stash.c b/platform/linux-generic/odp_stash.c index 8fe9c1096..c7d4136ab 100644 --- a/platform/linux-generic/odp_stash.c +++ b/platform/linux-generic/odp_stash.c @@ -69,7 +69,7 @@ int _odp_stash_init_global(void) odp_shm_t shm; if (odp_global_ro.disable.stash) { - ODP_PRINT("Stash is DISABLED\n"); + _ODP_PRINT("Stash is DISABLED\n"); return 0; } @@ -79,7 +79,7 @@ int _odp_stash_init_global(void) stash_global = odp_shm_addr(shm); if (stash_global == NULL) { - ODP_ERR("SHM reserve of stash global data failed\n"); + _ODP_ERR("SHM reserve of stash global data failed\n"); return -1; } @@ -99,7 +99,7 @@ int _odp_stash_term_global(void) return 0; if (odp_shm_free(stash_global->shm)) { - ODP_ERR("SHM free failed\n"); + _ODP_ERR("SHM free failed\n"); return -1; } @@ -109,7 +109,7 @@ int _odp_stash_term_global(void) int odp_stash_capability(odp_stash_capability_t *capa, odp_stash_type_t type) { if (odp_global_ro.disable.stash) { - ODP_ERR("Stash is disabled\n"); + _ODP_ERR("Stash is disabled\n"); return -1; } @@ -175,29 +175,29 @@ odp_stash_t odp_stash_create(const char *name, const odp_stash_param_t *param) uint32_t shm_flags = 0; if (odp_global_ro.disable.stash) { - ODP_ERR("Stash is disabled\n"); + _ODP_ERR("Stash is disabled\n"); return ODP_STASH_INVALID; } if (param->obj_size > sizeof(uint64_t)) { - ODP_ERR("Too large object handle.\n"); + _ODP_ERR("Too large object handle.\n"); return ODP_STASH_INVALID; } if (param->num_obj > MAX_RING_SIZE) { - ODP_ERR("Too many objects.\n"); + _ODP_ERR("Too many objects.\n"); return ODP_STASH_INVALID; } if (name && strlen(name) >= ODP_STASH_NAME_LEN) { - ODP_ERR("Too long name.\n"); + _ODP_ERR("Too long name.\n"); return ODP_STASH_INVALID; } index = reserve_index(); if (index < 0) { - ODP_ERR("Maximum number of stashes created already.\n"); + _ODP_ERR("Maximum number of stashes created already.\n"); return ODP_STASH_INVALID; } @@ -227,7 +227,7 @@ odp_stash_t odp_stash_create(const char *name, const odp_stash_param_t *param) shm = odp_shm_reserve(shm_name, shm_size, ODP_CACHE_LINE_SIZE, shm_flags); if (shm == ODP_SHM_INVALID) { - ODP_ERR("SHM reserve failed.\n"); + _ODP_ERR("SHM reserve failed.\n"); free_index(index); return ODP_STASH_INVALID; } @@ -279,7 +279,7 @@ int odp_stash_destroy(odp_stash_t st) free_index(index); if (odp_shm_free(shm)) { - ODP_ERR("SHM free failed.\n"); + _ODP_ERR("SHM free failed.\n"); return -1; } @@ -390,7 +390,7 @@ static inline int32_t stash_put_u32(odp_stash_t st, const uint32_t val[], if (odp_unlikely(st == ODP_STASH_INVALID)) return -1; - ODP_ASSERT(stash->obj_size == sizeof(uint32_t)); + _ODP_ASSERT(stash->obj_size == sizeof(uint32_t)); ring_u32_enq_multi(&stash->ring_u32.hdr, stash->ring_mask, (uint32_t *)(uintptr_t)val, num); @@ -417,7 +417,7 @@ static inline int32_t stash_put_u64(odp_stash_t st, const uint64_t val[], if (odp_unlikely(st == ODP_STASH_INVALID)) return -1; - ODP_ASSERT(stash->obj_size == sizeof(uint64_t)); + _ODP_ASSERT(stash->obj_size == sizeof(uint64_t)); ring_u64_enq_multi(&stash->ring_u64.hdr, stash->ring_mask, (uint64_t *)(uintptr_t)val, num); @@ -444,7 +444,7 @@ static inline int32_t stash_put_ptr(odp_stash_t st, const uintptr_t ptr[], if (odp_unlikely(st == ODP_STASH_INVALID)) return -1; - ODP_ASSERT(stash->obj_size == sizeof(uintptr_t)); + _ODP_ASSERT(stash->obj_size == sizeof(uintptr_t)); if (sizeof(uintptr_t) == sizeof(uint32_t)) ring_u32_enq_multi(&stash->ring_u32.hdr, stash->ring_mask, @@ -553,7 +553,7 @@ int32_t odp_stash_get_u32(odp_stash_t st, uint32_t val[], int32_t num) if (odp_unlikely(st == ODP_STASH_INVALID)) return -1; - ODP_ASSERT(stash->obj_size == sizeof(uint32_t)); + _ODP_ASSERT(stash->obj_size == sizeof(uint32_t)); return ring_u32_deq_multi(&stash->ring_u32.hdr, stash->ring_mask, val, num); @@ -566,7 +566,7 @@ int32_t odp_stash_get_u32_batch(odp_stash_t st, uint32_t val[], int32_t num) if (odp_unlikely(st == ODP_STASH_INVALID)) return -1; - ODP_ASSERT(stash->obj_size == sizeof(uint32_t)); + _ODP_ASSERT(stash->obj_size == sizeof(uint32_t)); return ring_u32_deq_batch(&stash->ring_u32.hdr, stash->ring_mask, val, num); } @@ -578,7 +578,7 @@ int32_t odp_stash_get_u64(odp_stash_t st, uint64_t val[], int32_t num) if (odp_unlikely(st == ODP_STASH_INVALID)) return -1; - ODP_ASSERT(stash->obj_size == sizeof(uint64_t)); + _ODP_ASSERT(stash->obj_size == sizeof(uint64_t)); return ring_u64_deq_multi(&stash->ring_u64.hdr, stash->ring_mask, val, num); @@ -591,7 +591,7 @@ int32_t odp_stash_get_u64_batch(odp_stash_t st, uint64_t val[], int32_t num) if (odp_unlikely(st == ODP_STASH_INVALID)) return -1; - ODP_ASSERT(stash->obj_size == sizeof(uint64_t)); + _ODP_ASSERT(stash->obj_size == sizeof(uint64_t)); return ring_u64_deq_batch(&stash->ring_u64.hdr, stash->ring_mask, val, num); } @@ -603,7 +603,7 @@ int32_t odp_stash_get_ptr(odp_stash_t st, uintptr_t ptr[], int32_t num) if (odp_unlikely(st == ODP_STASH_INVALID)) return -1; - ODP_ASSERT(stash->obj_size == sizeof(uintptr_t)); + _ODP_ASSERT(stash->obj_size == sizeof(uintptr_t)); if (sizeof(uintptr_t) == sizeof(uint32_t)) return ring_u32_deq_multi(&stash->ring_u32.hdr, @@ -623,7 +623,7 @@ int32_t odp_stash_get_ptr_batch(odp_stash_t st, uintptr_t ptr[], int32_t num) if (odp_unlikely(st == ODP_STASH_INVALID)) return -1; - ODP_ASSERT(stash->obj_size == sizeof(uintptr_t)); + _ODP_ASSERT(stash->obj_size == sizeof(uintptr_t)); if (sizeof(uintptr_t) == sizeof(uint32_t)) return ring_u32_deq_batch(&stash->ring_u32.hdr, stash->ring_mask, @@ -663,19 +663,19 @@ void odp_stash_print(odp_stash_t st) stash_t *stash = (stash_t *)(uintptr_t)st; if (st == ODP_STASH_INVALID) { - ODP_ERR("Bad stash handle\n"); + _ODP_ERR("Bad stash handle\n"); return; } - ODP_PRINT("\nStash info\n"); - ODP_PRINT("----------\n"); - ODP_PRINT(" handle 0x%" PRIx64 "\n", odp_stash_to_u64(st)); - ODP_PRINT(" name %s\n", stash->name); - ODP_PRINT(" index %i\n", stash->index); - ODP_PRINT(" obj size %u\n", stash->obj_size); - ODP_PRINT(" obj count %u\n", stash_obj_count(stash)); - ODP_PRINT(" ring size %u\n", stash->ring_mask + 1); - ODP_PRINT("\n"); + _ODP_PRINT("\nStash info\n"); + _ODP_PRINT("----------\n"); + _ODP_PRINT(" handle 0x%" PRIx64 "\n", odp_stash_to_u64(st)); + _ODP_PRINT(" name %s\n", stash->name); + _ODP_PRINT(" index %i\n", stash->index); + _ODP_PRINT(" obj size %u\n", stash->obj_size); + _ODP_PRINT(" obj count %u\n", stash_obj_count(stash)); + _ODP_PRINT(" ring size %u\n", stash->ring_mask + 1); + _ODP_PRINT("\n"); } int odp_stash_stats(odp_stash_t st, odp_stash_stats_t *stats) @@ -683,7 +683,7 @@ int odp_stash_stats(odp_stash_t st, odp_stash_stats_t *stats) stash_t *stash = (stash_t *)(uintptr_t)st; if (st == ODP_STASH_INVALID) { - ODP_ERR("Bad stash handle\n"); + _ODP_ERR("Bad stash handle\n"); return -1; } diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index ea48ec2e3..4f1d92357 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -55,7 +55,7 @@ static int read_cache_line_size(void) file = fopen(CACHE_LNSZ_FILE, "rt"); if (file == NULL) { /* File not found */ - ODP_PRINT("WARN: unable to read host CPU cache line size. " + _ODP_PRINT("WARN: unable to read host CPU cache line size. " "Using ODP_CACHE_LINE_SIZE instead.\n"); return ODP_CACHE_LINE_SIZE; } @@ -83,13 +83,13 @@ static uint64_t default_huge_page_size(void) while (fgets(str, sizeof(str), file) != NULL) { if (sscanf(str, "Hugepagesize: %8lu kB", &sz) == 1) { - ODP_DBG("defaut hp size is %lu kB\n", sz); + _ODP_DBG("defaut hp size is %lu kB\n", sz); fclose(file); return (uint64_t)sz * 1024; } } - ODP_ERR("unable to get default hp size\n"); + _ODP_ERR("unable to get default hp size\n"); fclose(file); return 0; } @@ -215,7 +215,7 @@ static char *get_hugepage_dir(uint64_t hugepage_sz) while (fgets(buf, sizeof(buf), fd)) { if (strsplit(buf, sizeof(buf), tokens, _FIELDNAME_MAX, split_tok) != _FIELDNAME_MAX) { - ODP_ERR("Error parsing %s\n", proc_mounts); + _ODP_ERR("Error parsing %s\n", proc_mounts); break; /* return NULL */ } @@ -292,14 +292,14 @@ static int system_cache_line(system_info_t *sysinfo) ret = read_cache_line_size(); if (ret == 0) { - ODP_ERR("read_cache_line_size failed.\n"); + _ODP_ERR("read_cache_line_size failed.\n"); return -1; } sysinfo->cache_line_size = ret; if (ret != ODP_CACHE_LINE_SIZE) - ODP_PRINT("WARN: host CPU cache line size and ODP_CACHE_LINE_SIZE don't match.\n"); + _ODP_PRINT("WARN: host CPU cache line size and ODP_CACHE_LINE_SIZE don't match.\n"); return 0; } @@ -324,21 +324,21 @@ static int read_config_file(void) str = "system.cpu_mhz"; if (!_odp_libconfig_lookup_int(str, &val)) { - ODP_ERR("Config option '%s' not found.\n", str); + _ODP_ERR("Config option '%s' not found.\n", str); return -1; } odp_global_ro.system_info.default_cpu_hz = (uint64_t)val * 1000000; str = "system.cpu_mhz_max"; if (!_odp_libconfig_lookup_int(str, &val)) { - ODP_ERR("Config option '%s' not found.\n", str); + _ODP_ERR("Config option '%s' not found.\n", str); return -1; } odp_global_ro.system_info.default_cpu_hz_max = (uint64_t)val * 1000000; str = "system.cpu_hz_static"; if (!_odp_libconfig_lookup_int(str, &val)) { - ODP_ERR("Config option '%s' not found.\n", str); + _ODP_ERR("Config option '%s' not found.\n", str); return -1; } odp_global_ro.system_info.cpu_hz_static = !!val; @@ -348,17 +348,17 @@ static int read_config_file(void) static void print_compiler_info(void) { - ODP_PRINT("Compiler defines:\n"); - ODP_PRINT(" __GCC_ATOMIC_LLONG_LOCK_FREE: %d\n", __GCC_ATOMIC_LLONG_LOCK_FREE); - ODP_PRINT(" __GCC_ATOMIC_LONG_LOCK_FREE: %d\n", __GCC_ATOMIC_LONG_LOCK_FREE); - ODP_PRINT(" __GCC_ATOMIC_INT_LOCK_FREE: %d\n", __GCC_ATOMIC_INT_LOCK_FREE); - ODP_PRINT(" __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16: "); + _ODP_PRINT("Compiler defines:\n"); + _ODP_PRINT(" __GCC_ATOMIC_LLONG_LOCK_FREE: %d\n", __GCC_ATOMIC_LLONG_LOCK_FREE); + _ODP_PRINT(" __GCC_ATOMIC_LONG_LOCK_FREE: %d\n", __GCC_ATOMIC_LONG_LOCK_FREE); + _ODP_PRINT(" __GCC_ATOMIC_INT_LOCK_FREE: %d\n", __GCC_ATOMIC_INT_LOCK_FREE); + _ODP_PRINT(" __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16: "); #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 - ODP_PRINT("1\n"); + _ODP_PRINT("1\n"); #else - ODP_PRINT("0\n"); + _ODP_PRINT("0\n"); #endif - ODP_PRINT("\n"); + _ODP_PRINT("\n"); } /* @@ -381,7 +381,7 @@ int _odp_system_info_init(void) /* Check that CONFIG_NUM_CPU_IDS is large enough */ num_cpus = get_nprocs_conf(); if (num_cpus > CONFIG_NUM_CPU_IDS) - ODP_ERR("Unable to handle all %d " + _ODP_ERR("Unable to handle all %d " "CPU IDs. Increase CONFIG_NUM_CPU_IDS value.\n", num_cpus); @@ -443,7 +443,7 @@ uint64_t odp_cpu_hz(void) uint64_t odp_cpu_hz_id(int id) { - ODP_ASSERT(id >= 0 && id < CONFIG_NUM_CPU_IDS); + _ODP_ASSERT(id >= 0 && id < CONFIG_NUM_CPU_IDS); if (odp_global_ro.system_info.cpu_hz_static) return cpu_hz_static(id); @@ -490,8 +490,7 @@ int odp_sys_huge_page_size_all(uint64_t size[], int num) /* See: kernel.org: hugetlbpage.txt */ dir = opendir("/sys/kernel/mm/hugepages"); if (!dir) { - ODP_PRINT("Failed to open /sys/kernel/mm/hugepages: %s\n", - strerror(errno)); + _ODP_PRINT("Failed to open /sys/kernel/mm/hugepages: %s\n", strerror(errno)); return 0; } @@ -587,7 +586,7 @@ void odp_sys_info_print(void) num_cpu, cpumask_str); str[len] = '\0'; - ODP_PRINT("%s", str); + _ODP_PRINT("%s", str); _odp_sys_info_print_arch(); } @@ -596,21 +595,21 @@ void odp_sys_config_print(void) { /* Print ODP_CONFIG_FILE default and override values */ if (_odp_libconfig_print()) - ODP_ERR("Config file print failed\n"); + _ODP_ERR("Config file print failed\n"); - ODP_PRINT("\n\nodp_config_internal.h values:\n" + _ODP_PRINT("\n\nodp_config_internal.h values:\n" "-----------------------------\n"); - ODP_PRINT("ODP_CONFIG_POOLS: %i\n", ODP_CONFIG_POOLS); - ODP_PRINT("CONFIG_MAX_PLAIN_QUEUES: %i\n", CONFIG_MAX_PLAIN_QUEUES); - ODP_PRINT("CONFIG_MAX_SCHED_QUEUES: %i\n", CONFIG_MAX_SCHED_QUEUES); - ODP_PRINT("CONFIG_QUEUE_MAX_ORD_LOCKS: %i\n", CONFIG_QUEUE_MAX_ORD_LOCKS); - ODP_PRINT("ODP_CONFIG_PKTIO_ENTRIES: %i\n", ODP_CONFIG_PKTIO_ENTRIES); - ODP_PRINT("CONFIG_PACKET_HEADROOM: %i\n", CONFIG_PACKET_HEADROOM); - ODP_PRINT("CONFIG_PACKET_TAILROOM: %i\n", CONFIG_PACKET_TAILROOM); - ODP_PRINT("CONFIG_SHM_BLOCKS: %i\n", CONFIG_SHM_BLOCKS); - ODP_PRINT("CONFIG_BURST_SIZE: %i\n", CONFIG_BURST_SIZE); - ODP_PRINT("CONFIG_POOL_MAX_NUM: %i\n", CONFIG_POOL_MAX_NUM); - ODP_PRINT("CONFIG_POOL_CACHE_MAX_SIZE: %i\n", CONFIG_POOL_CACHE_MAX_SIZE); - ODP_PRINT("CONFIG_TIMER_128BIT_ATOMICS: %i\n", CONFIG_TIMER_128BIT_ATOMICS); - ODP_PRINT("\n"); + _ODP_PRINT("ODP_CONFIG_POOLS: %i\n", ODP_CONFIG_POOLS); + _ODP_PRINT("CONFIG_MAX_PLAIN_QUEUES: %i\n", CONFIG_MAX_PLAIN_QUEUES); + _ODP_PRINT("CONFIG_MAX_SCHED_QUEUES: %i\n", CONFIG_MAX_SCHED_QUEUES); + _ODP_PRINT("CONFIG_QUEUE_MAX_ORD_LOCKS: %i\n", CONFIG_QUEUE_MAX_ORD_LOCKS); + _ODP_PRINT("ODP_CONFIG_PKTIO_ENTRIES: %i\n", ODP_CONFIG_PKTIO_ENTRIES); + _ODP_PRINT("CONFIG_PACKET_HEADROOM: %i\n", CONFIG_PACKET_HEADROOM); + _ODP_PRINT("CONFIG_PACKET_TAILROOM: %i\n", CONFIG_PACKET_TAILROOM); + _ODP_PRINT("CONFIG_SHM_BLOCKS: %i\n", CONFIG_SHM_BLOCKS); + _ODP_PRINT("CONFIG_BURST_SIZE: %i\n", CONFIG_BURST_SIZE); + _ODP_PRINT("CONFIG_POOL_MAX_NUM: %i\n", CONFIG_POOL_MAX_NUM); + _ODP_PRINT("CONFIG_POOL_CACHE_MAX_SIZE: %i\n", CONFIG_POOL_CACHE_MAX_SIZE); + _ODP_PRINT("CONFIG_TIMER_128BIT_ATOMICS: %i\n", CONFIG_TIMER_128BIT_ATOMICS); + _ODP_PRINT("\n"); } diff --git a/platform/linux-generic/odp_thread.c b/platform/linux-generic/odp_thread.c index ffb116974..bdfd758d7 100644 --- a/platform/linux-generic/odp_thread.c +++ b/platform/linux-generic/odp_thread.c @@ -58,11 +58,11 @@ int _odp_thread_init_global(void) const char *str = "system.thread_count_max"; if (!_odp_libconfig_lookup_int(str, &num_max)) { - ODP_ERR("Config option '%s' not found.\n", str); + _ODP_ERR("Config option '%s' not found.\n", str); return -1; } if (num_max <= 0) { - ODP_ERR("Config option '%s' not valid.\n", str); + _ODP_ERR("Config option '%s' not valid.\n", str); return -1; } if (num_max > ODP_THREAD_COUNT_MAX) @@ -80,8 +80,8 @@ int _odp_thread_init_global(void) memset(thread_globals, 0, sizeof(thread_globals_t)); odp_spinlock_init(&thread_globals->lock); thread_globals->num_max = num_max; - ODP_PRINT("System config:\n"); - ODP_PRINT(" system.thread_count_max: %d\n\n", num_max); + _ODP_PRINT("System config:\n"); + _ODP_PRINT(" system.thread_count_max: %d\n\n", num_max); return 0; } @@ -95,11 +95,11 @@ int _odp_thread_term_global(void) odp_spinlock_unlock(&thread_globals->lock); if (num) - ODP_ERR("%u threads have not called odp_term_local().\n", num); + _ODP_ERR("%u threads have not called odp_term_local().\n", num); ret = odp_shm_free(odp_shm_lookup("_odp_thread_global")); if (ret < 0) - ODP_ERR("shm free failed for _odp_thread_globals"); + _ODP_ERR("shm free failed for _odp_thread_globals"); return ret; } @@ -180,14 +180,14 @@ int _odp_thread_init_local(odp_thread_type_t type) odp_spinlock_unlock(&thread_globals->lock); if (id < 0) { - ODP_ERR("Too many threads\n"); + _ODP_ERR("Too many threads\n"); return -1; } cpu = sched_getcpu(); if (cpu < 0) { - ODP_ERR("getcpu failed\n"); + _ODP_ERR("getcpu failed\n"); return -1; } @@ -245,7 +245,7 @@ int _odp_thread_term_local(void) odp_spinlock_unlock(&thread_globals->lock); if (num < 0) { - ODP_ERR("failed to free thread id %i", id); + _ODP_ERR("failed to free thread id %i", id); return -1; } diff --git a/platform/linux-generic/odp_time.c b/platform/linux-generic/odp_time.c index b591d712a..3498008f1 100644 --- a/platform/linux-generic/odp_time.c +++ b/platform/linux-generic/odp_time.c @@ -57,7 +57,7 @@ odp_time_t _odp_timespec_cur(void) ret = clock_gettime(CLOCK_MONOTONIC_RAW, &sys_time); if (odp_unlikely(ret != 0)) - ODP_ABORT("clock_gettime failed\n"); + _ODP_ABORT("clock_gettime failed\n"); time.nsec = time_spec_diff_nsec(&sys_time, start_time); @@ -73,7 +73,7 @@ static inline uint64_t time_spec_res(void) ret = clock_getres(CLOCK_MONOTONIC_RAW, &tres); if (odp_unlikely(ret != 0)) - ODP_ABORT("clock_getres failed\n"); + _ODP_ABORT("clock_getres failed\n"); return ODP_TIME_SEC_IN_NS / (uint64_t)tres.tv_nsec; } @@ -194,8 +194,7 @@ int _odp_time_init_global(void) if (global->hw_freq_hz == 0) return -1; - ODP_PRINT("HW time counter freq: %" PRIu64 " hz\n\n", - global->hw_freq_hz); + _ODP_PRINT("HW time counter freq: %" PRIu64 " hz\n\n", global->hw_freq_hz); global->hw_start = _odp_cpu_global_time(); return 0; diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c index c0ca12ae0..133b9da93 100644 --- a/platform/linux-generic/odp_timer.c +++ b/platform/linux-generic/odp_timer.c @@ -251,8 +251,8 @@ static void timer_init(_odp_timer_t *tim, tick_buf_t *tb, odp_queue_t _q, const /* Teardown when timer is freed */ static void timer_fini(_odp_timer_t *tim, tick_buf_t *tb) { - ODP_ASSERT(tb->exp_tck.v == TMO_UNUSED); - ODP_ASSERT(tb->tmo_event == ODP_EVENT_INVALID); + _ODP_ASSERT(tb->exp_tck.v == TMO_UNUSED); + _ODP_ASSERT(tb->tmo_event == ODP_EVENT_INVALID); tim->queue = ODP_QUEUE_INVALID; tim->user_ptr = NULL; } @@ -265,7 +265,7 @@ static inline uint32_t get_next_free(_odp_timer_t *tim) static inline void set_next_free(_odp_timer_t *tim, uint32_t nf) { - ODP_ASSERT(tim->queue == ODP_QUEUE_INVALID); + _ODP_ASSERT(tim->queue == ODP_QUEUE_INVALID); /* Reusing 'queue' for next free index */ tim->queue = _odp_cast_scalar(odp_queue_t, nf); } @@ -285,11 +285,11 @@ static inline timer_pool_t *handle_to_tp(odp_timer_t hdl) uint32_t tp_idx = _odp_typeval(hdl) >> INDEX_BITS; timer_pool_t *tp; - ODP_ASSERT(tp_idx < MAX_TIMER_POOLS); + _ODP_ASSERT(tp_idx < MAX_TIMER_POOLS); tp = timer_global->timer_pool[tp_idx]; - ODP_ASSERT(tp != NULL); + _ODP_ASSERT(tp != NULL); return tp; } @@ -299,7 +299,7 @@ static inline uint32_t handle_to_idx(odp_timer_t hdl, { uint32_t idx = (_odp_typeval(hdl) & ((1U << INDEX_BITS) - 1U)) - 1; - ODP_ASSERT(idx < odp_atomic_load_u32(&tp->high_wm)); + _ODP_ASSERT(idx < odp_atomic_load_u32(&tp->high_wm)); __builtin_prefetch(&tp->tick_buf[idx], 0, 0); @@ -309,7 +309,7 @@ static inline uint32_t handle_to_idx(odp_timer_t hdl, static inline odp_timer_t tp_idx_to_handle(timer_pool_t *tp, uint32_t idx) { - ODP_ASSERT((idx + 1) < (1U << INDEX_BITS)); + _ODP_ASSERT((idx + 1) < (1U << INDEX_BITS)); return _odp_cast_scalar(odp_timer_t, (tp->tp_idx << INDEX_BITS) | (idx + 1)); } @@ -367,14 +367,14 @@ static odp_timer_pool_t timer_pool_new(const char *name, max_multiplier = param->periodic.max_multiplier; if (base_freq < MIN_BASE_HZ || base_freq > timer_global->max_base_hz) { - ODP_ERR("Bad base frequency: %f\n", base_freq); + _ODP_ERR("Bad base frequency: %f\n", base_freq); return ODP_TIMER_POOL_INVALID; } max_capa = max_multiplier_capa(base_freq); if (max_multiplier == 0 || max_multiplier > max_capa) { - ODP_ERR("Bad max multiplier: %" PRIu64 "\n", max_multiplier); + _ODP_ERR("Bad max multiplier: %" PRIu64 "\n", max_multiplier); return ODP_TIMER_POOL_INVALID; } @@ -393,7 +393,7 @@ static odp_timer_pool_t timer_pool_new(const char *name, if (timer_global->num_timer_pools >= MAX_TIMER_POOLS) { odp_ticketlock_unlock(&timer_global->lock); - ODP_DBG("No more free timer pools\n"); + _ODP_DBG("No more free timer pools\n"); return ODP_TIMER_POOL_INVALID; } @@ -419,7 +419,7 @@ static odp_timer_pool_t timer_pool_new(const char *name, if (tp_idx < 0) { odp_ticketlock_unlock(&timer_global->lock); - ODP_DBG("Did not find free timer pool\n"); + _ODP_DBG("Did not find free timer pool\n"); return ODP_TIMER_POOL_INVALID; } @@ -432,7 +432,7 @@ static odp_timer_pool_t timer_pool_new(const char *name, /* Free memory of previously destroyed timer pool */ if (shm != ODP_SHM_INVALID) { if (odp_shm_free(shm)) { - ODP_ERR("Failed to free shared memory: tp_idx %i\n", tp_idx); + _ODP_ERR("Failed to free shared memory: tp_idx %i\n", tp_idx); goto error; } } @@ -445,7 +445,7 @@ static odp_timer_pool_t timer_pool_new(const char *name, shm = odp_shm_reserve(name, tp_size, ODP_CACHE_LINE_SIZE, flags); if (odp_unlikely(shm == ODP_SHM_INVALID)) { - ODP_ERR("Timer pool shm reserve failed %" PRIu64 "kB\n", tp_size / 1024); + _ODP_ERR("Timer pool shm reserve failed %" PRIu64 "kB\n", tp_size / 1024); goto error; } @@ -560,11 +560,11 @@ static void stop_timer_thread(timer_pool_t *tp) { int ret; - ODP_DBG("stop\n"); + _ODP_DBG("stop\n"); tp->thr_exit = 1; ret = pthread_join(tp->thr_pthread, NULL); if (ret != 0) - ODP_ABORT("unable to join thread, err %d\n", ret); + _ODP_ABORT("unable to join thread, err %d\n", ret); } static void odp_timer_pool_del(timer_pool_t *tp) @@ -584,7 +584,7 @@ static void odp_timer_pool_del(timer_pool_t *tp) /* It's a programming error to attempt to destroy a */ /* timer pool which is still in use */ odp_spinlock_unlock(&tp->lock); - ODP_ABORT("%s: timers in use\n", tp->name); + _ODP_ABORT("%s: timers in use\n", tp->name); } odp_spinlock_unlock(&tp->lock); @@ -621,7 +621,7 @@ static inline odp_timer_t timer_alloc(timer_pool_t *tp, odp_queue_t queue, const if (odp_likely(tp->num_alloc < tp->param.num_timers)) { tp->num_alloc++; /* Remove first unused timer from free list */ - ODP_ASSERT(tp->first_free != tp->param.num_timers); + _ODP_ASSERT(tp->first_free != tp->param.num_timers); uint32_t idx = tp->first_free; _odp_timer_t *tim = &tp->timers[idx]; @@ -665,7 +665,7 @@ static inline odp_event_t timer_free(timer_pool_t *tp, uint32_t idx) odp_spinlock_lock(&tp->lock); set_next_free(tim, tp->first_free); tp->first_free = idx; - ODP_ASSERT(tp->num_alloc != 0); + _ODP_ASSERT(tp->num_alloc != 0); tp->num_alloc--; odp_spinlock_unlock(&tp->lock); @@ -959,8 +959,7 @@ static inline void timer_expire(timer_pool_t *tp, uint32_t idx, uint64_t tick) if (odp_unlikely(rc != 0)) { _odp_event_free(tmo_event); - ODP_ABORT("Failed to enqueue timeout event (%d)\n", - rc); + _ODP_ABORT("Failed to enqueue timeout event (%d)\n", rc); } } } @@ -971,7 +970,7 @@ static inline void timer_pool_scan(timer_pool_t *tp, uint64_t tick) uint32_t high_wm = odp_atomic_load_acq_u32(&tp->high_wm); uint32_t i; - ODP_ASSERT(high_wm <= tp->param.num_timers); + _ODP_ASSERT(high_wm <= tp->param.num_timers); for (i = 0; i < high_wm; i++) { /* As a rare occurrence, we can outsmart the HW prefetcher * and the compiler (GCC -fprefetch-loop-arrays) with some @@ -1043,11 +1042,11 @@ static inline void timer_pool_scan_inline(int num, odp_time_t now) if (odp_atomic_cas_u64(&tp->cur_tick, &old_tick, new_tick)) { if (tp->notify_overrun && diff > 1) { if (old_tick == 0) { - ODP_DBG("Timer pool (%s) missed %" PRIi64 " scans in start up\n", - tp->name, diff - 1); + _ODP_DBG("Timer pool (%s) missed %" PRIi64 " scans in start up\n", + tp->name, diff - 1); } else { - ODP_DBG("Timer pool (%s) resolution too high: %" PRIi64 " scans missed\n", - tp->name, diff - 1); + _ODP_DBG("Timer pool (%s) resolution too high: %" PRIi64 " scans missed\n", + tp->name, diff - 1); tp->notify_overrun = 0; } } @@ -1102,8 +1101,8 @@ static inline void timer_run_posix(timer_pool_t *tp) if (tp->notify_overrun) { overrun = timer_getoverrun(tp->timerid); if (overrun) { - ODP_DBG("\n\t%d ticks overrun on timer pool \"%s\", timer resolution too high\n", - overrun, tp->name); + _ODP_DBG("\n\t%d ticks overrun on timer pool \"%s\", timer resolution too high\n", + overrun, tp->name); tp->notify_overrun = 0; } } @@ -1189,8 +1188,7 @@ static int timer_res_init(void) /* Create timer */ if (timer_create(CLOCK_MONOTONIC, &sigev, &timerid)) - ODP_ABORT("timer_create() returned error %s\n", - strerror(errno)); + _ODP_ABORT("timer_create() returned error %s\n", strerror(errno)); /* Timer resolution start from 1ms */ res = ODP_TIME_MSEC_IN_NS; @@ -1214,8 +1212,7 @@ static int timer_res_init(void) ispec.it_value.tv_nsec = (long)nsec; if (timer_settime(timerid, 0, &ispec, NULL)) - ODP_ABORT("timer_settime() returned error %s\n", - strerror(errno)); + _ODP_ABORT("timer_settime() returned error %s\n", strerror(errno)); /* Set signal wait timeout to 10*res */ tmo.tv_sec = 0; tmo.tv_nsec = res * 10; @@ -1236,8 +1233,7 @@ static int timer_res_init(void) timer_res_init_done: timer_global->highest_res_ns *= TIMER_RES_ROUNDUP_FACTOR; if (timer_delete(timerid) != 0) - ODP_ABORT("timer_delete() returned error %s\n", - strerror(errno)); + _ODP_ABORT("timer_delete() returned error %s\n", strerror(errno)); sigemptyset(&sigset); sigprocmask(SIG_BLOCK, &sigset, NULL); return 0; @@ -1250,8 +1246,8 @@ static void itimer_init(timer_pool_t *tp) uint64_t res, sec, nsec; int ret; - ODP_DBG("Creating POSIX timer for timer pool %s, period %" - PRIu64 " ns\n", tp->name, tp->param.res_ns); + _ODP_DBG("Creating POSIX timer for timer pool %s, period %" PRIu64 " ns\n", + tp->name, tp->param.res_ns); res = tp->param.res_ns; sec = res / ODP_TIME_SEC_IN_NS; @@ -1267,7 +1263,7 @@ static void itimer_init(timer_pool_t *tp) odp_atomic_init_u32(&tp->thr_ready, 0); ret = pthread_create(&tp->thr_pthread, NULL, timer_thread, tp); if (ret) - ODP_ABORT("Unable to create timer thread: %d\n", ret); + _ODP_ABORT("Unable to create timer thread: %d\n", ret); /* wait thread set tp->thr_pid */ while (tp->thr_pid == 0) @@ -1280,8 +1276,7 @@ static void itimer_init(timer_pool_t *tp) sigev.sigev_signo = SIGALRM; if (timer_create(CLOCK_MONOTONIC, &sigev, &tp->timerid)) - ODP_ABORT("timer_create() returned error %s\n", - strerror(errno)); + _ODP_ABORT("timer_create() returned error %s\n", strerror(errno)); memset(&ispec, 0, sizeof(ispec)); ispec.it_interval.tv_sec = (time_t)sec; @@ -1290,8 +1285,7 @@ static void itimer_init(timer_pool_t *tp) ispec.it_value.tv_nsec = (long)nsec; if (timer_settime(tp->timerid, 0, &ispec, NULL)) - ODP_ABORT("timer_settime() returned error %s\n", - strerror(errno)); + _ODP_ABORT("timer_settime() returned error %s\n", strerror(errno)); /* Wait response from timer thread that warm up signals have been * processed. Warm up helps avoiding overrun on the first timeout. */ @@ -1302,8 +1296,7 @@ static void itimer_init(timer_pool_t *tp) static void itimer_fini(timer_pool_t *tp) { if (timer_delete(tp->timerid) != 0) - ODP_ABORT("timer_delete() returned error %s\n", - strerror(errno)); + _ODP_ABORT("timer_delete() returned error %s\n", strerror(errno)); } /****************************************************************************** @@ -1315,7 +1308,7 @@ int odp_timer_capability(odp_timer_clk_src_t clk_src, odp_timer_capability_t *capa) { if (clk_src != ODP_CLOCK_DEFAULT) { - ODP_ERR("Only ODP_CLOCK_DEFAULT supported. Requested %i.\n", clk_src); + _ODP_ERR("Only ODP_CLOCK_DEFAULT supported. Requested %i.\n", clk_src); return -1; } @@ -1348,12 +1341,12 @@ int odp_timer_res_capability(odp_timer_clk_src_t clk_src, odp_timer_res_capability_t *res_capa) { if (clk_src != ODP_CLOCK_DEFAULT) { - ODP_ERR("Only ODP_CLOCK_DEFAULT supported. Requested %i.\n", clk_src); + _ODP_ERR("Only ODP_CLOCK_DEFAULT supported. Requested %i.\n", clk_src); return -1; } if (res_capa->min_tmo) { - ODP_ERR("Only res_ns or max_tmo based quaries supported\n"); + _ODP_ERR("Only res_ns or max_tmo based quaries supported\n"); return -1; } @@ -1376,14 +1369,14 @@ int odp_timer_periodic_capability(odp_timer_clk_src_t clk_src, uint64_t multiplier; if (clk_src != ODP_CLOCK_DEFAULT) { - ODP_ERR("Only ODP_CLOCK_DEFAULT supported. Requested %i.\n", clk_src); + _ODP_ERR("Only ODP_CLOCK_DEFAULT supported. Requested %i.\n", clk_src); return -1; } freq = odp_fract_u64_to_dbl(&capa->base_freq_hz); if (freq < MIN_BASE_HZ || freq > timer_global->max_base_hz) { - ODP_ERR("Base frequency not supported (min: %f, max %f)\n", - (double)MIN_BASE_HZ, (double)timer_global->max_base_hz); + _ODP_ERR("Base frequency not supported (min: %f, max %f)\n", + (double)MIN_BASE_HZ, (double)timer_global->max_base_hz); return -1; } @@ -1415,18 +1408,18 @@ odp_timer_pool_t odp_timer_pool_create(const char *name, const odp_timer_pool_param_t *param) { if (odp_global_ro.init_param.not_used.feat.timer) { - ODP_ERR("Trying to use disabled ODP feature.\n"); + _ODP_ERR("Trying to use disabled ODP feature.\n"); return ODP_TIMER_POOL_INVALID; } if (param->clk_src != ODP_CLOCK_DEFAULT) { - ODP_ERR("Only ODP_CLOCK_DEFAULT supported. Requested %i.\n", param->clk_src); + _ODP_ERR("Only ODP_CLOCK_DEFAULT supported. Requested %i.\n", param->clk_src); return ODP_TIMER_POOL_INVALID; } if (param->timer_type != ODP_TIMER_TYPE_SINGLE && param->timer_type != ODP_TIMER_TYPE_PERIODIC) { - ODP_ERR("Bad timer type %i\n", param->timer_type); + _ODP_ERR("Bad timer type %i\n", param->timer_type); return ODP_TIMER_POOL_INVALID; } @@ -1473,7 +1466,7 @@ int odp_timer_pool_info(odp_timer_pool_t tpid, odp_timer_pool_info_t *tp_info) timer_pool_t *tp; if (odp_unlikely(tpid == ODP_TIMER_POOL_INVALID)) { - ODP_ERR("Invalid timer pool.\n"); + _ODP_ERR("Invalid timer pool.\n"); return -1; } @@ -1503,12 +1496,12 @@ odp_timer_t odp_timer_alloc(odp_timer_pool_t tpid, odp_queue_t queue, const void timer_pool_t *tp = timer_pool_from_hdl(tpid); if (odp_unlikely(tpid == ODP_TIMER_POOL_INVALID)) { - ODP_ERR("Invalid timer pool.\n"); + _ODP_ERR("Invalid timer pool.\n"); return ODP_TIMER_INVALID; } if (odp_unlikely(queue == ODP_QUEUE_INVALID)) { - ODP_ERR("%s: Invalid queue handle\n", tp->name); + _ODP_ERR("%s: Invalid queue handle\n", tp->name); return ODP_TIMER_INVALID; } /* We don't care about the validity of user_ptr because we will not @@ -1591,7 +1584,7 @@ int odp_timer_start(odp_timer_t timer, const odp_timer_start_t *start_param) /* Check that timer was not active */ if (odp_unlikely(tmo_ev != ODP_EVENT_INVALID)) { - ODP_ERR("Timer was active already\n"); + _ODP_ERR("Timer was active already\n"); odp_event_free(tmo_ev); } @@ -1641,28 +1634,28 @@ int odp_timer_periodic_start(odp_timer_t timer, const odp_timer_periodic_start_t double freq = multiplier * tp->base_freq; if (odp_unlikely(!tp->periodic)) { - ODP_ERR("Not a periodic timer\n"); + _ODP_ERR("Not a periodic timer\n"); return ODP_TIMER_FAIL; } if (odp_unlikely(multiplier == 0 || multiplier > tp->max_multiplier)) { - ODP_ERR("Bad frequency multiplier: %" PRIu64 "\n", multiplier); + _ODP_ERR("Bad frequency multiplier: %" PRIu64 "\n", multiplier); return ODP_TIMER_FAIL; } if (odp_unlikely(odp_event_type(tmo_ev) != ODP_EVENT_TIMEOUT)) { - ODP_ERR("Event type is not timeout\n"); + _ODP_ERR("Event type is not timeout\n"); return ODP_TIMER_FAIL; } period_ns = (uint64_t)((double)ODP_TIME_SEC_IN_NS / freq); if (period_ns == 0) { - ODP_ERR("Too high periodic timer frequency: %f\n", freq); + _ODP_ERR("Too high periodic timer frequency: %f\n", freq); return ODP_TIMER_FAIL; } if (period_ns & PERIODIC_CANCELLED) { - ODP_ERR("Periodic timer frequency error: %f\n", freq); + _ODP_ERR("Periodic timer frequency error: %f\n", freq); return ODP_TIMER_FAIL; } @@ -1684,7 +1677,7 @@ int odp_timer_periodic_start(odp_timer_t timer, const odp_timer_periodic_start_t /* Check that timer was not active */ if (odp_unlikely(tmo_ev != ODP_EVENT_INVALID)) { - ODP_ERR("Timer was active already\n"); + _ODP_ERR("Timer was active already\n"); odp_event_free(tmo_ev); } @@ -1700,7 +1693,7 @@ int odp_timer_periodic_ack(odp_timer_t timer, odp_event_t tmo_ev) _odp_timer_t *tim = &tp->timers[idx]; if (odp_unlikely(odp_event_type(tmo_ev) != ODP_EVENT_TIMEOUT)) { - ODP_ERR("Event type is not timeout\n"); + _ODP_ERR("Event type is not timeout\n"); return -1; } @@ -1720,7 +1713,7 @@ int odp_timer_periodic_ack(odp_timer_t timer, odp_event_t tmo_ev) * timer_reset() call above. */ if (odp_unlikely(tmo_ev != ODP_EVENT_INVALID)) { /* Reset returned an event, free it. */ - ODP_ERR("Timer was active already\n"); + _ODP_ERR("Timer was active already\n"); odp_event_free(tmo_ev); } @@ -1752,14 +1745,14 @@ int odp_timer_periodic_cancel(odp_timer_t hdl) odp_event_t ev; if (odp_unlikely(hdl == ODP_TIMER_INVALID)) { - ODP_ERR("Bad timer pool handle\n"); + _ODP_ERR("Bad timer pool handle\n"); return -1; } tp = handle_to_tp(hdl); if (odp_unlikely(tp->periodic == 0)) { - ODP_ERR("Not a periodic timer\n"); + _ODP_ERR("Not a periodic timer\n"); return -1; } @@ -1775,7 +1768,7 @@ int odp_timer_periodic_cancel(odp_timer_t hdl) /* Timer cancelled and timeout returned. Enqueue tmo, ack call will flag * it as the last event. */ if (odp_unlikely(odp_queue_enq(tim->queue, ev))) { - ODP_ERR("Failed to enqueue timeout event\n"); + _ODP_ERR("Failed to enqueue timeout event\n"); _odp_event_free(ev); return -1; } @@ -1813,11 +1806,11 @@ odp_timeout_t odp_timeout_alloc(odp_pool_t pool_hdl) odp_event_t event; pool_t *pool; - ODP_ASSERT(pool_hdl != ODP_POOL_INVALID); + _ODP_ASSERT(pool_hdl != ODP_POOL_INVALID); pool = _odp_pool_entry(pool_hdl); - ODP_ASSERT(pool->type == ODP_POOL_TIMEOUT); + _ODP_ASSERT(pool->type == ODP_POOL_TIMEOUT); event = _odp_event_alloc(pool); if (odp_unlikely(event == ODP_EVENT_INVALID)) @@ -1836,21 +1829,21 @@ void odp_timer_pool_print(odp_timer_pool_t timer_pool) timer_pool_t *tp; if (timer_pool == ODP_TIMER_POOL_INVALID) { - ODP_ERR("Bad timer pool handle\n"); + _ODP_ERR("Bad timer pool handle\n"); return; } tp = timer_pool_from_hdl(timer_pool); - ODP_PRINT("\nTimer pool info\n"); - ODP_PRINT("---------------\n"); - ODP_PRINT(" timer pool %p\n", (void *)tp); - ODP_PRINT(" tp index %u\n", tp->tp_idx); - ODP_PRINT(" num timers %u\n", tp->num_alloc); - ODP_PRINT(" num tp %i\n", timer_global->num_timer_pools); - ODP_PRINT(" inline timers %i\n", timer_global->use_inline_timers); - ODP_PRINT(" periodic %i\n", tp->periodic); - ODP_PRINT("\n"); + _ODP_PRINT("\nTimer pool info\n"); + _ODP_PRINT("---------------\n"); + _ODP_PRINT(" timer pool %p\n", (void *)tp); + _ODP_PRINT(" tp index %u\n", tp->tp_idx); + _ODP_PRINT(" num timers %u\n", tp->num_alloc); + _ODP_PRINT(" num tp %i\n", timer_global->num_timer_pools); + _ODP_PRINT(" inline timers %i\n", timer_global->use_inline_timers); + _ODP_PRINT(" periodic %i\n", tp->periodic); + _ODP_PRINT("\n"); } void odp_timer_print(odp_timer_t timer) @@ -1860,7 +1853,7 @@ void odp_timer_print(odp_timer_t timer) _odp_timer_t *tim; if (timer == ODP_TIMER_INVALID) { - ODP_ERR("Bad timer handle\n"); + _ODP_ERR("Bad timer handle\n"); return; } @@ -1868,14 +1861,14 @@ void odp_timer_print(odp_timer_t timer) idx = handle_to_idx(timer, tp); tim = &tp->timers[idx]; - ODP_PRINT("\nTimer info\n"); - ODP_PRINT("----------\n"); - ODP_PRINT(" timer pool %p\n", (void *)tp); - ODP_PRINT(" timer index %u\n", idx); - ODP_PRINT(" dest queue 0x%" PRIx64 "\n", odp_queue_to_u64(tim->queue)); - ODP_PRINT(" user ptr %p\n", tim->user_ptr); - ODP_PRINT(" periodic ticks %" PRIu64 "\n", tim->periodic_ticks & ~PERIODIC_CANCELLED); - ODP_PRINT("\n"); + _ODP_PRINT("\nTimer info\n"); + _ODP_PRINT("----------\n"); + _ODP_PRINT(" timer pool %p\n", (void *)tp); + _ODP_PRINT(" timer index %u\n", idx); + _ODP_PRINT(" dest queue 0x%" PRIx64 "\n", odp_queue_to_u64(tim->queue)); + _ODP_PRINT(" user ptr %p\n", tim->user_ptr); + _ODP_PRINT(" periodic ticks %" PRIu64 "\n", tim->periodic_ticks & ~PERIODIC_CANCELLED); + _ODP_PRINT("\n"); } void odp_timeout_print(odp_timeout_t tmo) @@ -1884,29 +1877,29 @@ void odp_timeout_print(odp_timeout_t tmo) odp_timer_t timer; if (tmo == ODP_TIMEOUT_INVALID) { - ODP_ERR("Bad timeout handle\n"); + _ODP_ERR("Bad timeout handle\n"); return; } tmo_hdr = timeout_hdr(tmo); timer = tmo_hdr->timer; - ODP_PRINT("\nTimeout info\n"); - ODP_PRINT("------------\n"); - ODP_PRINT(" tmo handle 0x%" PRIx64 "\n", odp_timeout_to_u64(tmo)); - ODP_PRINT(" expiration %" PRIu64 "\n", tmo_hdr->expiration); - ODP_PRINT(" user ptr %p\n", tmo_hdr->user_ptr); + _ODP_PRINT("\nTimeout info\n"); + _ODP_PRINT("------------\n"); + _ODP_PRINT(" tmo handle 0x%" PRIx64 "\n", odp_timeout_to_u64(tmo)); + _ODP_PRINT(" expiration %" PRIu64 "\n", tmo_hdr->expiration); + _ODP_PRINT(" user ptr %p\n", tmo_hdr->user_ptr); if (timer != ODP_TIMER_INVALID) { timer_pool_t *tp = handle_to_tp(timer); uint32_t idx = handle_to_idx(timer, tp); - ODP_PRINT(" timer pool %p\n", (void *)tp); - ODP_PRINT(" timer index %u\n", idx); - ODP_PRINT(" periodic %i\n", tp->periodic); + _ODP_PRINT(" timer pool %p\n", (void *)tp); + _ODP_PRINT(" timer index %u\n", idx); + _ODP_PRINT(" periodic %i\n", tp->periodic); } - ODP_PRINT("\n"); + _ODP_PRINT("\n"); } int _odp_timer_init_global(const odp_init_t *params) @@ -1918,7 +1911,7 @@ int _odp_timer_init_global(const odp_init_t *params) int val = 0; if (params && params->not_used.feat.timer) { - ODP_DBG("Timers disabled\n"); + _ODP_DBG("Timers disabled\n"); timer_global = NULL; return 0; } @@ -1929,7 +1922,7 @@ int _odp_timer_init_global(const odp_init_t *params) timer_global = odp_shm_addr(shm); if (timer_global == NULL) { - ODP_ERR("Shm reserve failed for odp_timer\n"); + _ODP_ERR("Shm reserve failed for odp_timer\n"); return -1; } @@ -1946,47 +1939,47 @@ int _odp_timer_init_global(const odp_init_t *params) } #if USE_128BIT_ATOMICS - ODP_PRINT("Timer using lock-less implementation\n"); + _ODP_PRINT("Timer using lock-less implementation\n"); #else - ODP_PRINT("Timer using lock-based implementation\n"); + _ODP_PRINT("Timer using lock-based implementation\n"); #endif - ODP_PRINT("Timer config:\n"); + _ODP_PRINT("Timer config:\n"); conf_str = "timer.inline"; if (!_odp_libconfig_lookup_int(conf_str, &val)) { - ODP_ERR("Config option '%s' not found.\n", conf_str); + _ODP_ERR("Config option '%s' not found.\n", conf_str); goto error; } timer_global->use_inline_timers = val; - ODP_PRINT(" %s: %i\n", conf_str, val); + _ODP_PRINT(" %s: %i\n", conf_str, val); conf_str = "timer.inline_poll_interval"; if (!_odp_libconfig_lookup_int(conf_str, &val)) { - ODP_ERR("Config option '%s' not found.\n", conf_str); + _ODP_ERR("Config option '%s' not found.\n", conf_str); goto error; } timer_global->poll_interval = val; - ODP_PRINT(" %s: %i\n", conf_str, val); + _ODP_PRINT(" %s: %i\n", conf_str, val); conf_str = "timer.inline_poll_interval_nsec"; if (!_odp_libconfig_lookup_int(conf_str, &val)) { - ODP_ERR("Config option '%s' not found.\n", conf_str); + _ODP_ERR("Config option '%s' not found.\n", conf_str); goto error; } timer_global->poll_interval_nsec = val; timer_global->poll_interval_time = odp_time_global_from_ns(timer_global->poll_interval_nsec); - ODP_PRINT(" %s: %i\n", conf_str, val); + _ODP_PRINT(" %s: %i\n", conf_str, val); conf_str = "timer.inline_thread_type"; if (!_odp_libconfig_lookup_int(conf_str, &val)) { - ODP_ERR("Config option '%s' not found.\n", conf_str); + _ODP_ERR("Config option '%s' not found.\n", conf_str); goto error; } timer_global->thread_type = val; - ODP_PRINT(" %s: %i\n", conf_str, val); - ODP_PRINT("\n"); + _ODP_PRINT(" %s: %i\n", conf_str, val); + _ODP_PRINT("\n"); if (!timer_global->use_inline_timers) { timer_res_init(); @@ -2016,14 +2009,14 @@ int _odp_timer_term_global(void) shm = timer_global->tp_shm[i]; if (shm != ODP_SHM_INVALID) { if (odp_shm_free(shm)) { - ODP_ERR("Shm free failed for timer pool %i\n", i); + _ODP_ERR("Shm free failed for timer pool %i\n", i); return -1; } } } if (odp_shm_free(timer_global->shm)) { - ODP_ERR("Shm free failed for timer_global\n"); + _ODP_ERR("Shm free failed for timer_global\n"); return -1; } diff --git a/platform/linux-generic/odp_timer_wheel.c b/platform/linux-generic/odp_timer_wheel.c index e597d5f70..ca2e73795 100644 --- a/platform/linux-generic/odp_timer_wheel.c +++ b/platform/linux-generic/odp_timer_wheel.c @@ -940,10 +940,10 @@ uint32_t _odp_timer_wheel_count(_odp_timer_wheel_t timer_wheel) static void _odp_int_timer_wheel_desc_print(wheel_desc_t *wheel_desc, uint32_t wheel_idx) { - ODP_PRINT(" wheel=%u num_slots=%u ticks_shift=%u ticks_per_slot=%u" - " ticks_per_rev=%" PRIu64 "\n", - wheel_idx, wheel_desc->num_slots, wheel_desc->ticks_shift, - wheel_desc->ticks_per_slot, wheel_desc->ticks_per_rev); + _ODP_PRINT(" wheel=%u num_slots=%u ticks_shift=%u ticks_per_slot=%u" + " ticks_per_rev=%" PRIu64 "\n", + wheel_idx, wheel_desc->num_slots, wheel_desc->ticks_shift, + wheel_desc->ticks_per_slot, wheel_desc->ticks_per_rev); } void _odp_timer_wheel_stats_print(_odp_timer_wheel_t timer_wheel) @@ -955,28 +955,28 @@ void _odp_timer_wheel_stats_print(_odp_timer_wheel_t timer_wheel) timer_wheels = (timer_wheels_t *)(uintptr_t)timer_wheel; expired_ring = timer_wheels->expired_timers_ring; - ODP_PRINT("_odp_int_timer_wheel_stats current_ticks=%" PRIu64 "\n", - timer_wheels->current_ticks); + _ODP_PRINT("_odp_int_timer_wheel_stats current_ticks=%" PRIu64 "\n", + timer_wheels->current_ticks); for (wheel_idx = 0; wheel_idx < 4; wheel_idx++) _odp_int_timer_wheel_desc_print(&timer_wheels->wheel_descs[wheel_idx], wheel_idx); - ODP_PRINT(" total timer_inserts=%" PRIu64 " timer_removes=%" PRIu64 - " insert_fails=%" PRIu64 "\n", - timer_wheels->total_timer_inserts, - timer_wheels->total_timer_removes, - timer_wheels->insert_fail_cnt); - ODP_PRINT(" total_promote_cnt=%" PRIu64 " promote_fail_cnt=%" - PRIu64 "\n", timer_wheels->total_promote_cnt, - timer_wheels->promote_fail_cnt); - ODP_PRINT(" free_list_size=%u min_size=%u peak_size=%u\n", - timer_wheels->free_list_size, - timer_wheels->min_free_list_size, - timer_wheels->peak_free_list_size); - ODP_PRINT(" expired_timers_ring size=%u count=%u " - "peak_count=%u full_cnt=%u\n", - expired_ring->max_idx + 1, expired_ring->count, - expired_ring->peak_count, - expired_ring->expired_ring_full_cnt); + _ODP_PRINT(" total timer_inserts=%" PRIu64 " timer_removes=%" PRIu64 + " insert_fails=%" PRIu64 "\n", + timer_wheels->total_timer_inserts, + timer_wheels->total_timer_removes, + timer_wheels->insert_fail_cnt); + _ODP_PRINT(" total_promote_cnt=%" PRIu64 " promote_fail_cnt=%" + PRIu64 "\n", timer_wheels->total_promote_cnt, + timer_wheels->promote_fail_cnt); + _ODP_PRINT(" free_list_size=%u min_size=%u peak_size=%u\n", + timer_wheels->free_list_size, + timer_wheels->min_free_list_size, + timer_wheels->peak_free_list_size); + _ODP_PRINT(" expired_timers_ring size=%u count=%u " + "peak_count=%u full_cnt=%u\n", + expired_ring->max_idx + 1, expired_ring->count, + expired_ring->peak_count, + expired_ring->expired_ring_full_cnt); } void _odp_timer_wheel_destroy(_odp_timer_wheel_t timer_wheel) diff --git a/platform/linux-generic/odp_traffic_mngr.c b/platform/linux-generic/odp_traffic_mngr.c index 423ef2da4..8b0062aef 100644 --- a/platform/linux-generic/odp_traffic_mngr.c +++ b/platform/linux-generic/odp_traffic_mngr.c @@ -366,7 +366,7 @@ static void *alloc_entry_in_tbl(profile_tbl_t *profile_tbl, return profile; } default: - ODP_ERR("Invalid TM profile\n"); + _ODP_ERR("Invalid TM profile\n"); return NULL; } } @@ -401,7 +401,7 @@ static void free_tbl_entry(profile_tbl_t *profile_tbl, return; default: - ODP_ERR("Invalid TM profile\n"); + _ODP_ERR("Invalid TM profile\n"); return; } } @@ -521,7 +521,7 @@ static void *tm_common_profile_create(const char *name, object_ptr = alloc_entry_in_tbl(&tm_glb->profile_tbl, profile_kind, &idx); if (!object_ptr) { - ODP_ERR("No free profiles left\n"); + _ODP_ERR("No free profiles left\n"); return NULL; } @@ -586,7 +586,7 @@ static void *tm_get_profile_params(tm_handle_t profile_handle, return &tm_glb->profile_tbl.wred.profile[idx]; default: - ODP_ERR("Invalid TM profile\n"); + _ODP_ERR("Invalid TM profile\n"); return NULL; } } @@ -769,7 +769,7 @@ static int tm_threshold_config_set(tm_wred_node_t *wred_node, threshold_params = tm_get_profile_params(thresholds_profile, TM_THRESHOLD_PROFILE); if (threshold_params == NULL) { - ODP_DBG("threshold_params is NULL\n"); + _ODP_DBG("threshold_params is NULL\n"); return -1; } @@ -953,7 +953,7 @@ static void tm_block_pkt(tm_system_t *tm_system, tm_queue_obj->timer_shaper, pkt_desc); else if (tm_queue_obj->timer_reason != NO_CALLBACK) - ODP_DBG("%s timer_reason != NO_CALLBACK\n", __func__); + _ODP_DBG("%s timer_reason != NO_CALLBACK\n", __func__); tm_queue_obj->blocked_cnt = 1; tm_queue_obj->blocked_scheduler = schedulers_obj; @@ -983,8 +983,7 @@ static odp_bool_t delay_pkt(tm_system_t *tm_system, rc = _odp_timer_wheel_insert(tm_system->_odp_int_timer_wheel, wakeup_time, timer_context); if (rc < 0) { - ODP_DBG("%s odp_timer_wheel_insert() failed rc=%d\n", - __func__, rc); + _ODP_DBG("%s odp_timer_wheel_insert() failed rc=%d\n", __func__, rc); return false; } @@ -1224,7 +1223,7 @@ static odp_bool_t run_sched(tm_system_t *tm_system, new_sched_state = &schedulers_obj->sched_states[priority]; prev_best_pkt_desc = new_sched_state->smallest_pkt_desc; if (pkt_descs_equal(new_pkt_desc, &prev_best_pkt_desc)) { - ODP_DBG("%s spurious execution ****\n", __func__); + _ODP_DBG("%s spurious execution ****\n", __func__); return false; } } @@ -1675,7 +1674,7 @@ static odp_bool_t tm_consume_pkt_desc(tm_system_t *tm_system, shaper_is_empty = new_shaper_pkt.queue_num == 0; if (pkt_descs_equal(&new_shaper_pkt, sent_pkt_desc)) - ODP_DBG("%s shaper has old pkt_desc\n", __func__); + _ODP_DBG("%s shaper has old pkt_desc\n", __func__); tm_node_obj = shaper_obj->next_tm_node; while (!tm_node_obj->is_root_node) { /* not at egress */ @@ -1685,7 +1684,7 @@ static odp_bool_t tm_consume_pkt_desc(tm_system_t *tm_system, /* Verify that the scheduler output is the sent_pkt_desc. */ if (pkt_descs_not_equal(&prev_sched_pkt, sent_pkt_desc)) { - ODP_DBG("%s sched has bad out pkt_desc\n", __func__); + _ODP_DBG("%s sched has bad out pkt_desc\n", __func__); return false; } @@ -1703,17 +1702,17 @@ static odp_bool_t tm_consume_pkt_desc(tm_system_t *tm_system, sched_is_empty = new_sched_pkt.queue_num == 0; if (pkt_descs_equal(&new_sched_pkt, sent_pkt_desc)) - ODP_DBG("%s sched has old pkt_desc\n", __func__); + _ODP_DBG("%s sched has old pkt_desc\n", __func__); if (pkt_descs_equal(&new_sched_pkt, sent_pkt_desc)) - ODP_DBG("%s scheduler has old pkt_desc\n", __func__); + _ODP_DBG("%s scheduler has old pkt_desc\n", __func__); shaper_obj = &tm_node_obj->shaper_obj; prev_shaper_pkt = shaper_obj->out_pkt_desc; /* Verify that the shaper output is the sent_pkt_desc. */ if (pkt_descs_not_equal(&prev_shaper_pkt, sent_pkt_desc)) { - ODP_DBG("%s shaper has bad out pkt_desc\n", __func__); + _ODP_DBG("%s shaper has bad out pkt_desc\n", __func__); return false; } @@ -1730,7 +1729,7 @@ static odp_bool_t tm_consume_pkt_desc(tm_system_t *tm_system, shaper_is_empty = new_shaper_pkt.queue_num == 0; if (pkt_descs_equal(&new_shaper_pkt, sent_pkt_desc)) - ODP_DBG("%s shaper has old pkt_desc\n", __func__); + _ODP_DBG("%s shaper has old pkt_desc\n", __func__); tm_node_obj = shaper_obj->next_tm_node; } @@ -2055,7 +2054,7 @@ static int tm_enqueue(tm_system_t *tm_system, _odp_sched_fn->order_unlock(); if (rc < 0) { - ODP_DBG("%s work queue full\n", __func__); + _ODP_DBG("%s work queue full\n", __func__); return rc; } @@ -2227,7 +2226,7 @@ static void tm_egress_marking(tm_system_t *tm_system, odp_packet_t odp_pkt) tm_tos_marking_t *ip_marking; color = odp_packet_color(odp_pkt); - ODP_ASSERT(color < ODP_NUM_PACKET_COLORS); + _ODP_ASSERT(color < ODP_NUM_PACKET_COLORS); if (odp_packet_has_vlan(odp_pkt)) { vlan_marking = &tm_system->marking.vlan_marking[color]; @@ -2328,8 +2327,7 @@ static int tm_process_input_work_queue(tm_system_t *tm_system, for (cnt = 1; cnt <= pkts_to_process; cnt++) { rc = input_work_queue_remove(input_work_queue, &work_item); if (rc < 0) { - ODP_DBG("%s input_work_queue_remove() failed\n", - __func__); + _ODP_DBG("%s input_work_queue_remove() failed\n", __func__); return rc; } @@ -2398,7 +2396,7 @@ static int tm_process_expired_timers(tm_system_t *tm_system, if (tm_queue_obj->timer_cancels_outstanding != 0) tm_queue_obj->timer_cancels_outstanding--; else - ODP_DBG("%s bad timer return\n", __func__); + _ODP_DBG("%s bad timer return\n", __func__); return work_done; } @@ -2475,8 +2473,7 @@ static int thread_affinity_get(odp_cpumask_t *odp_cpu_mask) CPU_ZERO(&linux_cpu_set); rc = sched_getaffinity(0, sizeof(cpu_set_t), &linux_cpu_set); if (rc != 0) { - ODP_DBG("%s sched_getaffinity failed with rc=%d\n", - __func__, rc); + _ODP_DBG("%s sched_getaffinity failed with rc=%d\n", __func__, rc); return -1; } @@ -2500,7 +2497,7 @@ static void *tm_system_thread(void *arg) rc = odp_init_local((odp_instance_t)odp_global_ro.main_pid, ODP_THREAD_WORKER); - ODP_ASSERT(rc == 0); + _ODP_ASSERT(rc == 0); tm_group = arg; tm_system = tm_group->first_tm_system; @@ -2564,7 +2561,7 @@ static void *tm_system_thread(void *arg) odp_barrier_wait(&tm_system->tm_system_destroy_barrier); if (odp_term_local() < 0) - ODP_ERR("Term local failed\n"); + _ODP_ERR("Term local failed\n"); return NULL; } @@ -2684,8 +2681,8 @@ int odp_tm_egress_capabilities(odp_tm_capabilities_t *capabilities, if (egress->egress_kind == ODP_TM_EGRESS_PKT_IO) { entry = get_pktio_entry(egress->pktio); if (entry == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", - (uintptr_t)egress->pktio); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", + (uintptr_t)egress->pktio); return -1; } @@ -2827,8 +2824,7 @@ static int affinitize_main_thread(void) if (rc == 0) tm_glb->main_thread_cpu = cpu_num; else - ODP_DBG("%s sched_setaffinity failed with rc=%d\n", - __func__, rc); + _ODP_DBG("%s sched_setaffinity failed with rc=%d\n", __func__, rc); return rc; } @@ -2883,8 +2879,7 @@ static int tm_thread_create(tm_system_group_t *tm_group) rc = pthread_create(&tm_group->thread, &tm_group->attr, tm_system_thread, tm_group); if (rc != 0) - ODP_ERR("Failed to start TM thread on CPU #%u: %d\n", cpu_num, - rc); + _ODP_ERR("Failed to start TM thread on CPU #%u: %d\n", cpu_num, rc); return rc; } @@ -2896,9 +2891,9 @@ static void _odp_tm_group_destroy(_odp_tm_group_t odp_tm_group) tm_group = GET_TM_GROUP(odp_tm_group); /* Wait for the thread to exit. */ - ODP_ASSERT(tm_group->num_tm_systems <= 1); + _ODP_ASSERT(tm_group->num_tm_systems <= 1); rc = pthread_join(tm_group->thread, NULL); - ODP_ASSERT(rc == 0); + _ODP_ASSERT(rc == 0); pthread_attr_destroy(&tm_group->attr); if (tm_glb->cpu_num > 0) tm_glb->cpu_num--; @@ -3059,18 +3054,18 @@ odp_tm_t odp_tm_create(const char *name, int rc; if (odp_global_ro.disable.traffic_mngr) { - ODP_ERR("TM has been disabled\n"); + _ODP_ERR("TM has been disabled\n"); return ODP_TM_INVALID; } if (odp_global_ro.init_param.mem_model == ODP_MEM_MODEL_PROCESS) { - ODP_ERR("TM is not supported in process mode\n"); + _ODP_ERR("TM is not supported in process mode\n"); return ODP_TM_INVALID; } /* We only support global pkt priority mode */ if (requirements->pkt_prio_mode != ODP_TM_PKT_PRIO_MODE_PRESERVE) { - ODP_ERR("Unsupported Packet priority mode\n"); + _ODP_ERR("Unsupported Packet priority mode\n"); return ODP_TM_INVALID; } odp_ticketlock_lock(&tm_glb->create_lock); @@ -4617,7 +4612,7 @@ int odp_tm_enq_multi_lso(odp_tm_queue_t tm_queue, const odp_packet_t packets[], const odp_packet_lso_opt_t *opt_ptr = &lso_opt; if (odp_unlikely(num <= 0)) { - ODP_ERR("No packets\n"); + _ODP_ERR("No packets\n"); return -1; } @@ -4632,7 +4627,7 @@ int odp_tm_enq_multi_lso(odp_tm_queue_t tm_queue, const odp_packet_t packets[], odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); if (pkt_hdr->p.flags.lso == 0) { - ODP_ERR("No LSO options on packet %i\n", i); + _ODP_ERR("No LSO options on packet %i\n", i); goto error; } /* Fill in LSO options from packet */ @@ -4644,14 +4639,14 @@ int odp_tm_enq_multi_lso(odp_tm_queue_t tm_queue, const odp_packet_t packets[], /* Calculate number of packets */ num_pkt = _odp_lso_num_packets(pkt, opt_ptr, &payload_len, &left_over_len); if (odp_unlikely(num_pkt <= 0)) { - ODP_DBG("LSO num packets failed on packet %i\n", i); + _ODP_DBG("LSO num packets failed on packet %i\n", i); goto error; } if (odp_unlikely(num_pkt == 1)) { /* Segmentation not needed */ if (odp_tm_enq_multi(tm_queue, &pkt, 1) != 1) { - ODP_DBG("TM enqueue failed on packet %i\n", i); + _ODP_DBG("TM enqueue failed on packet %i\n", i); goto error; } @@ -4672,7 +4667,7 @@ int odp_tm_enq_multi_lso(odp_tm_queue_t tm_queue, const odp_packet_t packets[], ret = odp_tm_enq_multi(tm_queue, pkt_out, num_pkt); if (odp_unlikely(ret < num_pkt)) { - ODP_DBG("TM enqueue failed on packet %i\n", i); + _ODP_DBG("TM enqueue failed on packet %i\n", i); if (ret < 0) ret = 0; @@ -4978,19 +4973,19 @@ void odp_tm_stats_print(odp_tm_t odp_tm) tm_system = GET_TM_SYSTEM(odp_tm); input_work_queue = &tm_system->input_work_queue; - ODP_PRINT("odp_tm_stats_print - tm_system=0x%" PRIX64 " tm_idx=%u\n", - odp_tm, tm_system->tm_idx); - ODP_PRINT(" input_work_queue size=%u current cnt=%" PRIu64 " peak cnt=%" PRIu32 "\n", - INPUT_WORK_RING_SIZE, odp_atomic_load_u64(&input_work_queue->queue_cnt), - input_work_queue->peak_cnt); - ODP_PRINT(" input_work_queue enqueues=%" PRIu64 " dequeues=%" PRIu64 - " fail_cnt=%" PRIu64 "\n", input_work_queue->total_enqueues, - input_work_queue->total_dequeues, - input_work_queue->enqueue_fail_cnt); - ODP_PRINT(" green_cnt=%" PRIu64 " yellow_cnt=%" PRIu64 " red_cnt=%" - PRIu64 "\n", tm_system->shaper_green_cnt, - tm_system->shaper_yellow_cnt, - tm_system->shaper_red_cnt); + _ODP_PRINT("tm_system=0x%" PRIX64 " tm_idx=%u\n", + odp_tm, tm_system->tm_idx); + _ODP_PRINT(" input_work_queue size=%u current cnt=%" PRIu64 " peak cnt=%" PRIu32 "\n", + INPUT_WORK_RING_SIZE, odp_atomic_load_u64(&input_work_queue->queue_cnt), + input_work_queue->peak_cnt); + _ODP_PRINT(" input_work_queue enqueues=%" PRIu64 " dequeues=%" PRIu64 + " fail_cnt=%" PRIu64 "\n", input_work_queue->total_enqueues, + input_work_queue->total_dequeues, + input_work_queue->enqueue_fail_cnt); + _ODP_PRINT(" green_cnt=%" PRIu64 " yellow_cnt=%" PRIu64 " red_cnt=%" PRIu64 "\n", + tm_system->shaper_green_cnt, + tm_system->shaper_yellow_cnt, + tm_system->shaper_red_cnt); _odp_pkt_queue_stats_print(tm_system->_odp_int_queue_pool); _odp_timer_wheel_stats_print(tm_system->_odp_int_timer_wheel); @@ -4999,7 +4994,7 @@ void odp_tm_stats_print(odp_tm_t odp_tm) for (queue_num = 1; queue_num <= ODP_TM_MAX_TM_QUEUES; queue_num++) { tm_queue_obj = tm_system->queue_num_tbl[queue_num - 1]; if (tm_queue_obj && tm_queue_obj->pkts_rcvd_cnt != 0) - ODP_PRINT("queue_num=%u priority=%u rcvd=%u enqueued=%u " + _ODP_PRINT("queue_num=%u priority=%u rcvd=%u enqueued=%u " "dequeued=%u consumed=%u\n", queue_num, tm_queue_obj->priority, @@ -5015,7 +5010,7 @@ int odp_tm_queue_stats(odp_tm_queue_t tm_queue, odp_tm_queue_stats_t *stats) tm_queue_obj_t *tm_queue_obj = GET_TM_QUEUE_OBJ(tm_queue); if (!tm_queue_obj) { - ODP_ERR("Invalid TM queue handle\n"); + _ODP_ERR("Invalid TM queue handle\n"); return -1; } @@ -5067,7 +5062,7 @@ int _odp_tm_init_global(void) odp_shm_t shm; if (odp_global_ro.disable.traffic_mngr) { - ODP_PRINT("\nODP traffic manager is DISABLED\n"); + _ODP_PRINT("\nODP traffic manager is DISABLED\n"); return 0; } @@ -5104,7 +5099,7 @@ int _odp_tm_term_global(void) return 0; if (odp_shm_free(tm_glb->shm)) { - ODP_ERR("shm free failed\n"); + _ODP_ERR("shm free failed\n"); return -1; } return 0; diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index ec14615d8..30e6a0e61 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -215,8 +215,7 @@ static int lookup_opt(const char *opt_name, const char *drv_name, int *val) ret = _odp_libconfig_lookup_ext_int(base, drv_name, opt_name, val); if (ret == 0) - ODP_ERR("Unable to find DPDK configuration option: %s\n", - opt_name); + _ODP_ERR("Unable to find DPDK configuration option: %s\n", opt_name); return ret; } @@ -233,7 +232,7 @@ static int init_options(pktio_entry_t *pktio_entry, if (opt->num_rx_desc < dev_info->rx_desc_lim.nb_min || opt->num_rx_desc > dev_info->rx_desc_lim.nb_max || opt->num_rx_desc % dev_info->rx_desc_lim.nb_align) { - ODP_ERR("Invalid number of RX descriptors\n"); + _ODP_ERR("Invalid number of RX descriptors\n"); return -1; } @@ -253,12 +252,12 @@ static int init_options(pktio_entry_t *pktio_entry, return -1; opt->multicast_en = !!val; - ODP_DBG("DPDK interface (%s): %" PRIu16 "\n", dev_info->driver_name, - pkt_priv(pktio_entry)->port_id); - ODP_DBG(" multicast_en: %d\n", opt->multicast_en); - ODP_DBG(" num_rx_desc: %d\n", opt->num_rx_desc); - ODP_DBG(" num_tx_desc: %d\n", opt->num_tx_desc_default); - ODP_DBG(" rx_drop_en: %d\n", opt->rx_drop_en); + _ODP_DBG("DPDK interface (%s): %" PRIu16 "\n", dev_info->driver_name, + pkt_priv(pktio_entry)->port_id); + _ODP_DBG(" multicast_en: %d\n", opt->multicast_en); + _ODP_DBG(" num_rx_desc: %d\n", opt->num_rx_desc); + _ODP_DBG(" num_tx_desc: %d\n", opt->num_tx_desc_default); + _ODP_DBG(" rx_drop_en: %d\n", opt->rx_drop_en); return 0; } @@ -283,7 +282,7 @@ static uint32_t cache_size(uint32_t num) } if (odp_unlikely(size > RTE_MEMPOOL_CACHE_MAX_SIZE || (uint32_t)size * 1.5 > num)) { - ODP_ERR("Cache size calc failure: %d\n", size); + _ODP_ERR("Cache size calc failure: %d\n", size); size = 0; } @@ -339,7 +338,7 @@ static void pktmbuf_init(struct rte_mempool *mp, void *opaque_arg ODP_UNUSED, m->buf_iova = rte_mem_virt2iova(buf_addr); if (odp_unlikely(m->buf_iova == 0)) - ODP_ABORT("Bad IO virtual address\n"); + _ODP_ABORT("Bad IO virtual address\n"); m->buf_len = (uint16_t)buf_len; m->data_off = RTE_PKTMBUF_HEADROOM; @@ -371,28 +370,28 @@ static struct rte_mempool *mbuf_pool_create(const char *name, int ret; if (!(pool_entry->mem_from_huge_pages)) { - ODP_ERR("DPDK requires memory is allocated from huge pages\n"); + _ODP_ERR("DPDK requires memory is allocated from huge pages\n"); goto fail; } if (pool_entry->seg_len < RTE_MBUF_DEFAULT_BUF_SIZE) { - ODP_ERR("Some NICs need at least %dB buffers to not segment " - "standard ethernet frames. Increase pool seg_len.\n", - RTE_MBUF_DEFAULT_BUF_SIZE); + _ODP_ERR("Some NICs need at least %dB buffers to not segment " + "standard ethernet frames. Increase pool seg_len.\n", + RTE_MBUF_DEFAULT_BUF_SIZE); goto fail; } if (odp_shm_info(pool_entry->shm, &shm_info)) { - ODP_ERR("Failed to query SHM info.\n"); + _ODP_ERR("Failed to query SHM info.\n"); goto fail; } page_size = shm_info.page_size; total_size = rte_mempool_calc_obj_size(elt_size, MEMPOOL_FLAGS, &sz); if (total_size != pool_entry->block_size) { - ODP_ERR("DPDK pool block size not matching to ODP pool: " - "%" PRIu32 "/%" PRIu32 "\n", total_size, - pool_entry->block_size); + _ODP_ERR("DPDK pool block size not matching to ODP pool: " + "%" PRIu32 "/%" PRIu32 "\n", total_size, + pool_entry->block_size); goto fail; } @@ -400,14 +399,14 @@ static struct rte_mempool *mbuf_pool_create(const char *name, sizeof(struct rte_pktmbuf_pool_private), rte_socket_id(), MEMPOOL_FLAGS); if (mp == NULL) { - ODP_ERR("Failed to create empty DPDK packet pool\n"); + _ODP_ERR("Failed to create empty DPDK packet pool\n"); goto fail; } mp->pool_data = _odp_pool_handle(pool_entry); if (rte_mempool_set_ops_byname(mp, "odp_pool", pool_entry)) { - ODP_ERR("Failed setting mempool operations\n"); + _ODP_ERR("Failed setting mempool operations\n"); goto fail; } @@ -429,7 +428,7 @@ static struct rte_mempool *mbuf_pool_create(const char *name, NULL, NULL); if (ret <= 0) { - ODP_ERR("Failed to populate mempool: %d\n", ret); + _ODP_ERR("Failed to populate mempool: %d\n", ret); goto fail; } @@ -438,8 +437,8 @@ static struct rte_mempool *mbuf_pool_create(const char *name, } if (populated != num) { - ODP_ERR("Failed to populate mempool with all requested blocks, populated: %u, " - "requested: %u\n", populated, num); + _ODP_ERR("Failed to populate mempool with all requested blocks, populated: %u, " + "requested: %u\n", populated, num); goto fail; } @@ -516,7 +515,7 @@ static unsigned pool_get_count(const struct rte_mempool *mp) odp_pool_info_t info; if (odp_pool_info(pool, &info)) { - ODP_ERR("Failed to read pool info\n"); + _ODP_ERR("Failed to read pool info\n"); return 0; } return info.params.pkt.num; @@ -565,7 +564,7 @@ static int pool_create(uint8_t *data, pool_t *pool) pkt_pool = mbuf_pool_create(pool_name, pool, mem_src_data->dpdk_elt_size); if (pkt_pool == NULL) { - ODP_ERR("Creating external DPDK pool failed\n"); + _ODP_ERR("Creating external DPDK pool failed\n"); return -1; } @@ -588,7 +587,7 @@ static void pool_obj_size(uint8_t *data, uint32_t *block_size, uint32_t *block_o if (odp_global_rw->dpdk_initialized == 0) { if (dpdk_pktio_init()) { - ODP_ERR("Initializing DPDK failed\n"); + _ODP_ERR("Initializing DPDK failed\n"); *block_size = 0; return; } @@ -640,8 +639,8 @@ static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry, num = _odp_packet_alloc_multi(pool, max_len + frame_offset, pkt_table, mbuf_num); if (num != mbuf_num) { - ODP_DBG("_odp_packet_alloc_multi() unable to allocate all packets: " - "%d/%" PRIu16 " allocated\n", num, mbuf_num); + _ODP_DBG("_odp_packet_alloc_multi() unable to allocate all packets: " + "%d/%" PRIu16 " allocated\n", num, mbuf_num); for (i = num; i < mbuf_num; i++) rte_pktmbuf_free(mbuf_table[i]); } @@ -649,7 +648,7 @@ static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry, for (i = 0; i < num; i++) { mbuf = mbuf_table[i]; if (odp_unlikely(mbuf->nb_segs != 1)) { - ODP_ERR("Segmented buffers not supported\n"); + _ODP_ERR("Segmented buffers not supported\n"); goto fail; } @@ -855,7 +854,7 @@ static inline int pkt_to_mbuf(pktio_entry_t *pktio_entry, if (odp_unlikely((rte_pktmbuf_alloc_bulk(pkt_dpdk->pkt_pool, mbuf_table, num)))) { - ODP_ERR("Failed to alloc mbuf\n"); + _ODP_ERR("Failed to alloc mbuf\n"); return 0; } for (i = 0; i < num; i++) { @@ -936,7 +935,7 @@ static inline int mbuf_to_pkt_zero(pktio_entry_t *pktio_entry, mbuf = mbuf_table[i]; if (odp_unlikely(mbuf->nb_segs != 1)) { - ODP_ERR("Segmented buffers not supported\n"); + _ODP_ERR("Segmented buffers not supported\n"); rte_pktmbuf_free(mbuf); continue; } @@ -1077,7 +1076,7 @@ static uint32_t dpdk_vdev_mtu_get(uint16_t port_id) sockfd = socket(AF_INET, SOCK_DGRAM, 0); if (sockfd < 0) { - ODP_ERR("Failed to create control socket\n"); + _ODP_ERR("Failed to create control socket\n"); return 0; } @@ -1126,7 +1125,7 @@ static int dpdk_maxlen_set(pktio_entry_t *pktio_entry, uint32_t maxlen_input, ret = rte_eth_dev_set_mtu(pkt_dpdk->port_id, mtu); if (odp_unlikely(ret)) - ODP_ERR("rte_eth_dev_set_mtu() failed: %d\n", ret); + _ODP_ERR("rte_eth_dev_set_mtu() failed: %d\n", ret); pkt_dpdk->mtu = maxlen_input; pkt_dpdk->mtu_set = 1; @@ -1148,7 +1147,7 @@ static int dpdk_vdev_promisc_mode_get(uint16_t port_id) sockfd = socket(AF_INET, SOCK_DGRAM, 0); if (sockfd < 0) { - ODP_ERR("Failed to create control socket\n"); + _ODP_ERR("Failed to create control socket\n"); return -1; } @@ -1171,7 +1170,7 @@ static int dpdk_vdev_promisc_mode_set(uint16_t port_id, int enable) sockfd = socket(AF_INET, SOCK_DGRAM, 0); if (sockfd < 0) { - ODP_ERR("Failed to create control socket\n"); + _ODP_ERR("Failed to create control socket\n"); return -1; } @@ -1251,8 +1250,8 @@ static int dpdk_setup_eth_dev(pktio_entry_t *pktio_entry) pktio_entry->num_in_queue, pktio_entry->num_out_queue, ð_conf); if (ret < 0) { - ODP_ERR("Failed to setup device: err=%d, port=%" PRIu8 "\n", - ret, pkt_dpdk->port_id); + _ODP_ERR("Failed to setup device: err=%d, port=%" PRIu8 "\n", + ret, pkt_dpdk->port_id); return -1; } return 0; @@ -1301,7 +1300,7 @@ static int dpdk_pktio_init(void) i = pthread_getaffinity_np(pthread_self(), sizeof(original_cpuset), &original_cpuset); if (i != 0) { - ODP_ERR("Failed to read thread affinity: %d\n", i); + _ODP_ERR("Failed to read thread affinity: %d\n", i); return -1; } @@ -1315,7 +1314,7 @@ static int dpdk_pktio_init(void) masklen = odp_cpumask_to_str(&mask, mask_str, ODP_CPUMASK_STR_SIZE); if (masklen < 0) { - ODP_ERR("CPU mask error: %" PRId32 "\n", masklen); + _ODP_ERR("CPU mask error: %" PRId32 "\n", masklen); return -1; } @@ -1359,7 +1358,7 @@ static int dpdk_pktio_init(void) dpdk_argc = rte_strsplit(full_cmd, strlen(full_cmd), dpdk_argv, dpdk_argc, ' '); for (i = 0; i < dpdk_argc; ++i) - ODP_DBG("arg[%d]: %s\n", i, dpdk_argv[i]); + _ODP_DBG("arg[%d]: %s\n", i, dpdk_argv[i]); i = rte_eal_init(dpdk_argc, dpdk_argv); @@ -1367,22 +1366,22 @@ static int dpdk_pktio_init(void) optind = 0; if (i < 0) { - ODP_ERR("Cannot init the Intel DPDK EAL!\n"); + _ODP_ERR("Cannot init the Intel DPDK EAL!\n"); return -1; } else if (i + 1 != dpdk_argc) { - ODP_DBG("Some DPDK args were not processed!\n"); - ODP_DBG("Passed: %d Consumed %d\n", dpdk_argc, i + 1); + _ODP_DBG("Some DPDK args were not processed!\n"); + _ODP_DBG("Passed: %d Consumed %d\n", dpdk_argc, i + 1); } - ODP_DBG("rte_eal_init OK\n"); + _ODP_DBG("rte_eal_init OK\n"); rte_log_set_global_level(RTE_LOG_WARNING); i = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &original_cpuset); if (i) - ODP_ERR("Failed to reset thread affinity: %d\n", i); + _ODP_ERR("Failed to reset thread affinity: %d\n", i); - ODP_PRINT("\nDPDK version: %s\n", rte_version()); + _ODP_PRINT("\nDPDK version: %s\n", rte_version()); return 0; } @@ -1391,12 +1390,12 @@ static int dpdk_pktio_init(void) static int dpdk_pktio_init_global(void) { if (getenv("ODP_PKTIO_DISABLE_DPDK")) { - ODP_PRINT("PKTIO: dpdk pktio skipped," - " enabled export ODP_PKTIO_DISABLE_DPDK=1.\n"); + _ODP_PRINT("PKTIO: dpdk pktio skipped," + " enabled export ODP_PKTIO_DISABLE_DPDK=1.\n"); disable_pktio = 1; } else { - ODP_PRINT("PKTIO: initialized dpdk pktio," - " use export ODP_PKTIO_DISABLE_DPDK=1 to disable.\n"); + _ODP_PRINT("PKTIO: initialized dpdk pktio," + " use export ODP_PKTIO_DISABLE_DPDK=1 to disable.\n"); } return 0; } @@ -1407,7 +1406,7 @@ static int dpdk_pktio_init_local(void) cpu = sched_getcpu(); if (cpu < 0) { - ODP_ERR("getcpu failed\n"); + _ODP_ERR("getcpu failed\n"); return -1; } @@ -1457,33 +1456,33 @@ static void prepare_rss_conf(pktio_entry_t *pktio_entry, /* Print debug info about unsupported hash protocols */ if (p->hash_proto.proto.ipv4 && ((rss_hf_capa & ETH_RSS_IPV4) == 0)) - ODP_PRINT("DPDK: hash_proto.ipv4 not supported (rss_hf_capa 0x%" PRIx64 ")\n", - rss_hf_capa); + _ODP_PRINT("DPDK: hash_proto.ipv4 not supported (rss_hf_capa 0x%" PRIx64 ")\n", + rss_hf_capa); if (p->hash_proto.proto.ipv4_udp && ((rss_hf_capa & ETH_RSS_NONFRAG_IPV4_UDP) == 0)) - ODP_PRINT("DPDK: hash_proto.ipv4_udp not supported (rss_hf_capa 0x%" PRIx64 ")\n", - rss_hf_capa); + _ODP_PRINT("DPDK: hash_proto.ipv4_udp not supported (rss_hf_capa 0x%" PRIx64 ")\n", + rss_hf_capa); if (p->hash_proto.proto.ipv4_tcp && ((rss_hf_capa & ETH_RSS_NONFRAG_IPV4_TCP) == 0)) - ODP_PRINT("DPDK: hash_proto.ipv4_tcp not supported (rss_hf_capa 0x%" PRIx64 ")\n", - rss_hf_capa); + _ODP_PRINT("DPDK: hash_proto.ipv4_tcp not supported (rss_hf_capa 0x%" PRIx64 ")\n", + rss_hf_capa); if (p->hash_proto.proto.ipv6 && ((rss_hf_capa & ETH_RSS_IPV6) == 0)) - ODP_PRINT("DPDK: hash_proto.ipv6 not supported (rss_hf_capa 0x%" PRIx64 ")\n", - rss_hf_capa); + _ODP_PRINT("DPDK: hash_proto.ipv6 not supported (rss_hf_capa 0x%" PRIx64 ")\n", + rss_hf_capa); if (p->hash_proto.proto.ipv6_udp && ((rss_hf_capa & ETH_RSS_NONFRAG_IPV6_UDP) == 0)) - ODP_PRINT("DPDK: hash_proto.ipv6_udp not supported (rss_hf_capa 0x%" PRIx64 ")\n", - rss_hf_capa); + _ODP_PRINT("DPDK: hash_proto.ipv6_udp not supported (rss_hf_capa 0x%" PRIx64 ")\n", + rss_hf_capa); if (p->hash_proto.proto.ipv6_tcp && ((rss_hf_capa & ETH_RSS_NONFRAG_IPV6_TCP) == 0)) - ODP_PRINT("DPDK: hash_proto.ipv6_tcp not supported (rss_hf_capa 0x%" PRIx64 ")\n", - rss_hf_capa); + _ODP_PRINT("DPDK: hash_proto.ipv6_tcp not supported (rss_hf_capa 0x%" PRIx64 ")\n", + rss_hf_capa); hash_proto_to_rss_conf(&pkt_dpdk->rss_conf, &p->hash_proto); @@ -1530,7 +1529,7 @@ static int dpdk_output_queues_config(pktio_entry_t *pktio_entry, ret = rte_eth_dev_info_get(pkt_dpdk->port_id, &dev_info); if (ret) { - ODP_ERR("DPDK: rte_eth_dev_info_get() failed: %d\n", ret); + _ODP_ERR("DPDK: rte_eth_dev_info_get() failed: %d\n", ret); return -1; } @@ -1549,7 +1548,7 @@ static int dpdk_output_queues_config(pktio_entry_t *pktio_entry, if (num_tx_desc < dev_info.tx_desc_lim.nb_min || num_tx_desc > dev_info.tx_desc_lim.nb_max || num_tx_desc % dev_info.tx_desc_lim.nb_align) { - ODP_ERR("DPDK: invalid number of TX descriptors\n"); + _ODP_ERR("DPDK: invalid number of TX descriptors\n"); return -1; } pkt_dpdk->num_tx_desc[i] = num_tx_desc; @@ -1594,7 +1593,7 @@ static int dpdk_init_capability(pktio_entry_t *pktio_entry, if (ret == 0) { capa->set_op.op.mac_addr = 1; } else if (ret != -ENOTSUP && ret != -EPERM) { - ODP_ERR("Failed to set interface default MAC: %d\n", ret); + _ODP_ERR("Failed to set interface default MAC: %d\n", ret); return -1; } @@ -1743,7 +1742,7 @@ static int dpdk_open(odp_pktio_t id ODP_UNUSED, else if (dpdk_netdev_is_valid(netdev)) pkt_dpdk->port_id = atoi(netdev); else { - ODP_ERR("Invalid DPDK interface name: %s\n", netdev); + _ODP_ERR("Invalid DPDK interface name: %s\n", netdev); return -1; } @@ -1757,27 +1756,27 @@ static int dpdk_open(odp_pktio_t id ODP_UNUSED, pkt_dpdk->pool = pool; if (rte_eth_dev_count_avail() == 0) { - ODP_ERR("No DPDK ports found\n"); + _ODP_ERR("No DPDK ports found\n"); return -1; } memset(&dev_info, 0, sizeof(struct rte_eth_dev_info)); ret = rte_eth_dev_info_get(pkt_dpdk->port_id, &dev_info); if (ret) { - ODP_ERR("Failed to read device info: %d\n", ret); + _ODP_ERR("Failed to read device info: %d\n", ret); return -1; } /* Initialize runtime options */ if (init_options(pktio_entry, &dev_info)) { - ODP_ERR("Initializing runtime options failed\n"); + _ODP_ERR("Initializing runtime options failed\n"); return -1; } pkt_dpdk->flags.set_flow_hash = pkt_dpdk->opt.set_flow_hash; /* Copy for fast path access */ mtu = dpdk_mtu_get(pktio_entry); if (mtu == 0) { - ODP_ERR("Failed to read interface MTU\n"); + _ODP_ERR("Failed to read interface MTU\n"); return -1; } pkt_dpdk->mtu = mtu + _ODP_ETHHDR_LEN; @@ -1793,7 +1792,7 @@ static int dpdk_open(odp_pktio_t id ODP_UNUSED, /* Not supported by all PMDs, so ignore the return value */ if (ret) - ODP_DBG("Configuring multicast reception not supported by the PMD\n"); + _ODP_DBG("Configuring multicast reception not supported by the PMD\n"); /* Drivers requiring minimum burst size. Supports also *_vf versions * of the drivers. */ @@ -1824,7 +1823,7 @@ static int dpdk_open(odp_pktio_t id ODP_UNUSED, } } if (pkt_pool == NULL) { - ODP_ERR("Cannot init mbuf packet pool\n"); + _ODP_ERR("Cannot init mbuf packet pool\n"); return -1; } @@ -1842,7 +1841,7 @@ static int dpdk_open(odp_pktio_t id ODP_UNUSED, pkt_dpdk->mtu_max = RTE_MIN(pkt_dpdk->mtu_max, pkt_dpdk->data_room); if (dpdk_init_capability(pktio_entry, &dev_info)) { - ODP_ERR("Failed to initialize capability\n"); + _ODP_ERR("Failed to initialize capability\n"); return -1; } @@ -1870,8 +1869,7 @@ static int dpdk_setup_eth_tx(pktio_entry_t *pktio_entry, rte_eth_dev_socket_id(port_id), &dev_info->default_txconf); if (ret < 0) { - ODP_ERR("Queue setup failed: err=%d, port=%" PRIu8 "\n", - ret, port_id); + _ODP_ERR("Queue setup failed: err=%d, port=%" PRIu8 "\n", ret, port_id); return -1; } } @@ -1881,11 +1879,11 @@ static int dpdk_setup_eth_tx(pktio_entry_t *pktio_entry, for (i = 0; i < pktio_entry->num_out_queue && i < RTE_ETHDEV_QUEUE_STAT_CNTRS; i++) { ret = rte_eth_dev_set_tx_queue_stats_mapping(port_id, i, i); if (ret) { - ODP_DBG("Mapping per TX queue statistics not supported: %d\n", ret); + _ODP_DBG("Mapping per TX queue statistics not supported: %d\n", ret); break; } } - ODP_DBG("Mapped %" PRIu32 "/%d TX counters\n", i, RTE_ETHDEV_QUEUE_STAT_CNTRS); + _ODP_DBG("Mapped %" PRIu32 "/%d TX counters\n", i, RTE_ETHDEV_QUEUE_STAT_CNTRS); return 0; } @@ -1909,8 +1907,7 @@ static int dpdk_setup_eth_rx(const pktio_entry_t *pktio_entry, rte_eth_dev_socket_id(port_id), &rxconf, pkt_dpdk->pkt_pool); if (ret < 0) { - ODP_ERR("Queue setup failed: err=%d, port=%" PRIu8 "\n", - ret, port_id); + _ODP_ERR("Queue setup failed: err=%d, port=%" PRIu8 "\n", ret, port_id); return -1; } } @@ -1920,11 +1917,11 @@ static int dpdk_setup_eth_rx(const pktio_entry_t *pktio_entry, for (i = 0; i < pktio_entry->num_in_queue && i < RTE_ETHDEV_QUEUE_STAT_CNTRS; i++) { ret = rte_eth_dev_set_rx_queue_stats_mapping(port_id, i, i); if (ret) { - ODP_DBG("Mapping per RX queue statistics not supported: %d\n", ret); + _ODP_DBG("Mapping per RX queue statistics not supported: %d\n", ret); break; } } - ODP_DBG("Mapped %" PRIu32 "/%d RX counters\n", i, RTE_ETHDEV_QUEUE_STAT_CNTRS); + _ODP_DBG("Mapped %" PRIu32 "/%d RX counters\n", i, RTE_ETHDEV_QUEUE_STAT_CNTRS); return 0; } @@ -1946,7 +1943,7 @@ static int dpdk_start(pktio_entry_t *pktio_entry) /* Setup device */ if (dpdk_setup_eth_dev(pktio_entry)) { - ODP_ERR("Failed to configure device\n"); + _ODP_ERR("Failed to configure device\n"); return -1; } @@ -1962,16 +1959,15 @@ static int dpdk_start(pktio_entry_t *pktio_entry) if (pkt_dpdk->mtu_set && pktio_entry->capa.set_op.op.maxlen) { ret = dpdk_maxlen_set(pktio_entry, pkt_dpdk->mtu, 0); if (ret) { - ODP_ERR("Restoring device MTU failed: err=%d, port=%" PRIu8 "\n", - ret, port_id); + _ODP_ERR("Restoring device MTU failed: err=%d, port=%" PRIu8 "\n", + ret, port_id); return -1; } } /* Start device */ ret = rte_eth_dev_start(port_id); if (ret < 0) { - ODP_ERR("Device start failed: err=%d, port=%" PRIu8 "\n", - ret, port_id); + _ODP_ERR("Device start failed: err=%d, port=%" PRIu8 "\n", ret, port_id); return -1; } @@ -2191,7 +2187,7 @@ static int dpdk_link_info(pktio_entry_t *pktio_entry, odp_pktio_link_info_t *inf ret = rte_eth_dev_flow_ctrl_get(port_id, &fc_conf); if (ret && ret != -ENOTSUP) { - ODP_ERR("rte_eth_dev_flow_ctrl_get() failed\n"); + _ODP_ERR("rte_eth_dev_flow_ctrl_get() failed\n"); return -1; } @@ -2278,7 +2274,7 @@ static int dpdk_extra_stat_info(pktio_entry_t *pktio_entry, num_stats = rte_eth_xstats_get_names(port_id, NULL, 0); if (num_stats < 0) { - ODP_ERR("rte_eth_xstats_get_names() failed: %d\n", num_stats); + _ODP_ERR("rte_eth_xstats_get_names() failed: %d\n", num_stats); return num_stats; } else if (info == NULL || num == 0 || num_stats == 0) { return num_stats; @@ -2288,7 +2284,7 @@ static int dpdk_extra_stat_info(pktio_entry_t *pktio_entry, ret = rte_eth_xstats_get_names(port_id, xstats_names, num_stats); if (ret < 0 || ret > num_stats) { - ODP_ERR("rte_eth_xstats_get_names() failed: %d\n", ret); + _ODP_ERR("rte_eth_xstats_get_names() failed: %d\n", ret); return -1; } num_stats = ret; @@ -2308,7 +2304,7 @@ static int dpdk_extra_stats(pktio_entry_t *pktio_entry, num_stats = rte_eth_xstats_get(port_id, NULL, 0); if (num_stats < 0) { - ODP_ERR("rte_eth_xstats_get() failed: %d\n", num_stats); + _ODP_ERR("rte_eth_xstats_get() failed: %d\n", num_stats); return num_stats; } else if (stats == NULL || num == 0 || num_stats == 0) { return num_stats; @@ -2318,7 +2314,7 @@ static int dpdk_extra_stats(pktio_entry_t *pktio_entry, ret = rte_eth_xstats_get(port_id, xstats, num_stats); if (ret < 0 || ret > num_stats) { - ODP_ERR("rte_eth_xstats_get() failed: %d\n", ret); + _ODP_ERR("rte_eth_xstats_get() failed: %d\n", ret); return -1; } num_stats = ret; @@ -2338,7 +2334,7 @@ static int dpdk_extra_stat_counter(pktio_entry_t *pktio_entry, uint32_t id, ret = rte_eth_xstats_get_by_id(port_id, &xstat_id, stat, 1); if (ret != 1) { - ODP_ERR("rte_eth_xstats_get_by_id() failed: %d\n", ret); + _ODP_ERR("rte_eth_xstats_get_by_id() failed: %d\n", ret); return -1; } @@ -2352,14 +2348,13 @@ static int dpdk_pktin_stats(pktio_entry_t *pktio_entry, uint32_t index, int ret; if (odp_unlikely(index > RTE_ETHDEV_QUEUE_STAT_CNTRS - 1)) { - ODP_ERR("DPDK supports max %d per queue counters\n", - RTE_ETHDEV_QUEUE_STAT_CNTRS); + _ODP_ERR("DPDK supports max %d per queue counters\n", RTE_ETHDEV_QUEUE_STAT_CNTRS); return -1; } ret = rte_eth_stats_get(pkt_priv(pktio_entry)->port_id, &rte_stats); if (odp_unlikely(ret)) { - ODP_ERR("Failed to read DPDK pktio stats: %d\n", ret); + _ODP_ERR("Failed to read DPDK pktio stats: %d\n", ret); return -1; } @@ -2379,14 +2374,13 @@ static int dpdk_pktout_stats(pktio_entry_t *pktio_entry, uint32_t index, int ret; if (odp_unlikely(index > RTE_ETHDEV_QUEUE_STAT_CNTRS - 1)) { - ODP_ERR("DPDK supports max %d per queue counters\n", - RTE_ETHDEV_QUEUE_STAT_CNTRS); + _ODP_ERR("DPDK supports max %d per queue counters\n", RTE_ETHDEV_QUEUE_STAT_CNTRS); return -1; } ret = rte_eth_stats_get(pkt_priv(pktio_entry)->port_id, &rte_stats); if (odp_unlikely(ret)) { - ODP_ERR("Failed to read DPDK pktio stats: %d\n", ret); + _ODP_ERR("Failed to read DPDK pktio stats: %d\n", ret); return -1; } diff --git a/platform/linux-generic/pktio/ethtool_rss.c b/platform/linux-generic/pktio/ethtool_rss.c index 80a66420e..df97e2417 100644 --- a/platform/linux-generic/pktio/ethtool_rss.c +++ b/platform/linux-generic/pktio/ethtool_rss.c @@ -248,6 +248,6 @@ void _odp_rss_conf_print(const odp_pktin_hash_proto_t *hash_proto) " IPV6 UDP\n"); str[len] = '\0'; - ODP_PRINT("%s\n", str); + _ODP_PRINT("%s\n", str); } diff --git a/platform/linux-generic/pktio/ipc.c b/platform/linux-generic/pktio/ipc.c index f3246c068..586bc0aa7 100644 --- a/platform/linux-generic/pktio/ipc.c +++ b/platform/linux-generic/pktio/ipc.c @@ -128,7 +128,7 @@ static ring_ptr_t *_ring_create(const char *name, uint32_t count, /* count must be a power of 2 */ if (!_ODP_CHECK_IS_POWER2(count)) { - ODP_ERR("Requested size is invalid, must be a power of 2\n"); + _ODP_ERR("Requested size is invalid, must be a power of 2\n"); _odp_errno = EINVAL; return NULL; } @@ -145,7 +145,7 @@ static ring_ptr_t *_ring_create(const char *name, uint32_t count, } else { _odp_errno = ENOMEM; - ODP_ERR("Cannot reserve memory\n"); + _ODP_ERR("Cannot reserve memory\n"); } return r; @@ -210,8 +210,7 @@ static int _ipc_master_start(pktio_entry_t *pktio_entry) shm = _ipc_map_remote_pool(pinfo->slave.pool_name, pinfo->slave.pid); if (shm == ODP_SHM_INVALID) { - ODP_DBG("no pool file %s for pid %d\n", - pinfo->slave.pool_name, pinfo->slave.pid); + _ODP_DBG("no pool file %s for pid %d\n", pinfo->slave.pool_name, pinfo->slave.pid); return -1; } @@ -238,7 +237,7 @@ static int _ipc_init_master(pktio_entry_t *pktio_entry, uint32_t ring_mask; if ((uint64_t)_ODP_ROUNDUP_POWER2_U32(pool->num + 1) > UINT32_MAX) { - ODP_ERR("Too large packet pool\n"); + _ODP_ERR("Too large packet pool\n"); return -1; } @@ -254,13 +253,13 @@ static int _ipc_init_master(pktio_entry_t *pktio_entry, pktio_ipc->ring_mask = ring_mask; if (strlen(dev) > (ODP_POOL_NAME_LEN - sizeof("_m_prod"))) { - ODP_ERR("too big ipc name\n"); + _ODP_ERR("too big ipc name\n"); return -1; } pktio_ipc->rx.cache = _ring_create("ipc_rx_cache", ring_size, 0); if (!pktio_ipc->rx.cache) { - ODP_ERR("pid %d unable to create ipc rx cache\n", getpid()); + _ODP_ERR("pid %d unable to create ipc rx cache\n", getpid()); return -1; } @@ -271,13 +270,12 @@ static int _ipc_init_master(pktio_entry_t *pktio_entry, pktio_ipc->tx.send = _ring_create(ipc_shm_name, ring_size, ODP_SHM_PROC | ODP_SHM_EXPORT); if (!pktio_ipc->tx.send) { - ODP_ERR("pid %d unable to create ipc ring %s name\n", - getpid(), ipc_shm_name); + _ODP_ERR("pid %d unable to create ipc ring %s name\n", getpid(), ipc_shm_name); return -1; } - ODP_DBG("Created IPC ring: %s, count %d, free %d\n", - ipc_shm_name, _ring_count(pktio_ipc->tx.send, ring_mask), - _ring_free_count(pktio_ipc->tx.send, ring_mask)); + _ODP_DBG("Created IPC ring: %s, count %d, free %d\n", + ipc_shm_name, _ring_count(pktio_ipc->tx.send, ring_mask), + _ring_free_count(pktio_ipc->tx.send, ring_mask)); /* generate name in shm like ipc_pktio_p for * already processed packets @@ -286,44 +284,41 @@ static int _ipc_init_master(pktio_entry_t *pktio_entry, pktio_ipc->tx.free = _ring_create(ipc_shm_name, ring_size, ODP_SHM_PROC | ODP_SHM_EXPORT); if (!pktio_ipc->tx.free) { - ODP_ERR("pid %d unable to create ipc ring %s name\n", - getpid(), ipc_shm_name); + _ODP_ERR("pid %d unable to create ipc ring %s name\n", getpid(), ipc_shm_name); goto free_m_prod; } - ODP_DBG("Created IPC ring: %s, count %d, free %d\n", - ipc_shm_name, _ring_count(pktio_ipc->tx.free, ring_mask), - _ring_free_count(pktio_ipc->tx.free, ring_mask)); + _ODP_DBG("Created IPC ring: %s, count %d, free %d\n", + ipc_shm_name, _ring_count(pktio_ipc->tx.free, ring_mask), + _ring_free_count(pktio_ipc->tx.free, ring_mask)); snprintf(ipc_shm_name, sizeof(ipc_shm_name), "%s_s_prod", dev); pktio_ipc->rx.recv = _ring_create(ipc_shm_name, ring_size, ODP_SHM_PROC | ODP_SHM_EXPORT); if (!pktio_ipc->rx.recv) { - ODP_ERR("pid %d unable to create ipc ring %s name\n", - getpid(), ipc_shm_name); + _ODP_ERR("pid %d unable to create ipc ring %s name\n", getpid(), ipc_shm_name); goto free_m_cons; } - ODP_DBG("Created IPC ring: %s, count %d, free %d\n", - ipc_shm_name, _ring_count(pktio_ipc->rx.recv, ring_mask), - _ring_free_count(pktio_ipc->rx.recv, ring_mask)); + _ODP_DBG("Created IPC ring: %s, count %d, free %d\n", + ipc_shm_name, _ring_count(pktio_ipc->rx.recv, ring_mask), + _ring_free_count(pktio_ipc->rx.recv, ring_mask)); snprintf(ipc_shm_name, sizeof(ipc_shm_name), "%s_s_cons", dev); pktio_ipc->rx.free = _ring_create(ipc_shm_name, ring_size, ODP_SHM_PROC | ODP_SHM_EXPORT); if (!pktio_ipc->rx.free) { - ODP_ERR("pid %d unable to create ipc ring %s name\n", - getpid(), ipc_shm_name); + _ODP_ERR("pid %d unable to create ipc ring %s name\n", getpid(), ipc_shm_name); goto free_s_prod; } - ODP_DBG("Created IPC ring: %s, count %d, free %d\n", - ipc_shm_name, _ring_count(pktio_ipc->rx.free, ring_mask), - _ring_free_count(pktio_ipc->rx.free, ring_mask)); + _ODP_DBG("Created IPC ring: %s, count %d, free %d\n", + ipc_shm_name, _ring_count(pktio_ipc->rx.free, ring_mask), + _ring_free_count(pktio_ipc->rx.free, ring_mask)); /* Set up pool name for remote info */ pinfo = pktio_ipc->pinfo; pool_name = _ipc_odp_buffer_pool_shm_name(pool_hdl); if (strlen(pool_name) > ODP_POOL_NAME_LEN) { - ODP_ERR("pid %d ipc pool name %s is too big %zu\n", - getpid(), pool_name, strlen(pool_name)); + _ODP_ERR("pid %d ipc pool name %s is too big %zu\n", + getpid(), pool_name, strlen(pool_name)); goto free_s_prod; } @@ -340,7 +335,7 @@ static int _ipc_init_master(pktio_entry_t *pktio_entry, pktio_ipc->pool = pool_hdl; - ODP_DBG("Pre init... DONE.\n"); + _ODP_DBG("Pre init... DONE.\n"); pinfo->master.init_done = 1; _ipc_master_start(pktio_entry); @@ -378,7 +373,7 @@ static odp_shm_t _ipc_map_remote_pool(const char *name, int pid) snprintf(rname, ODP_SHM_NAME_LEN, "remote-%s", name); shm = odp_shm_import(name, pid, rname); if (shm == ODP_SHM_INVALID) { - ODP_ERR("unable map %s\n", name); + _ODP_ERR("unable map %s\n", name); return ODP_SHM_INVALID; } @@ -392,7 +387,7 @@ static void *_ipc_shm_map(char *name, int pid) shm = odp_shm_import(name, pid, name); if (ODP_SHM_INVALID == shm) { - ODP_ERR("unable to map: %s\n", name); + _ODP_ERR("unable to map: %s\n", name); return NULL; } @@ -407,20 +402,20 @@ static int _ipc_init_slave(const char *dev, pktio_entry_t *pktio_entry, uint32_t ring_size = pktio_ipc->pinfo->master.ring_size; if (strlen(dev) > (ODP_POOL_NAME_LEN - sizeof("_slave_r"))) { - ODP_ERR("Too big ipc name\n"); + _ODP_ERR("Too big ipc name\n"); return -1; } /* Check that IPC rings are able to store all packets */ if (pool->num >= ring_size) { - ODP_ERR("Slave process packet pool too large. Master process " + _ODP_ERR("Slave process packet pool too large. Master process " "packet pool has to be larger than slave pool.\n"); return -1; } pktio_ipc->rx.cache = _ring_create("ipc_rx_cache", ring_size, 0); if (!pktio_ipc->rx.cache) { - ODP_ERR("Pid %d unable to create ipc rx cache\n", getpid()); + _ODP_ERR("Pid %d unable to create ipc rx cache\n", getpid()); return -1; } pktio_ipc->ring_size = ring_size; @@ -442,7 +437,7 @@ static int _ipc_slave_start(pktio_entry_t *pktio_entry) uint32_t ring_mask = pktio_ipc->ring_mask; if (sscanf(pktio_entry->name, "ipc:%d:%s", &pid, tail) != 2) { - ODP_ERR("wrong pktio name\n"); + _ODP_ERR("wrong pktio name\n"); return -1; } @@ -451,47 +446,43 @@ static int _ipc_slave_start(pktio_entry_t *pktio_entry) snprintf(ipc_shm_name, sizeof(ipc_shm_name), "%s_m_prod", dev); pktio_ipc->rx.recv = _ipc_shm_map(ipc_shm_name, pid); if (!pktio_ipc->rx.recv) { - ODP_DBG("pid %d unable to find ipc ring %s name\n", - getpid(), dev); + _ODP_DBG("pid %d unable to find ipc ring %s name\n", getpid(), dev); sleep(1); return -1; } - ODP_DBG("Connected IPC ring: %s, count %d, free %d\n", - ipc_shm_name, _ring_count(pktio_ipc->rx.recv, ring_mask), - _ring_free_count(pktio_ipc->rx.recv, ring_mask)); + _ODP_DBG("Connected IPC ring: %s, count %d, free %d\n", + ipc_shm_name, _ring_count(pktio_ipc->rx.recv, ring_mask), + _ring_free_count(pktio_ipc->rx.recv, ring_mask)); snprintf(ipc_shm_name, sizeof(ipc_shm_name), "%s_m_cons", dev); pktio_ipc->rx.free = _ipc_shm_map(ipc_shm_name, pid); if (!pktio_ipc->rx.free) { - ODP_ERR("pid %d unable to find ipc ring %s name\n", - getpid(), dev); + _ODP_ERR("pid %d unable to find ipc ring %s name\n", getpid(), dev); goto free_m_prod; } - ODP_DBG("Connected IPC ring: %s, count %d, free %d\n", - ipc_shm_name, _ring_count(pktio_ipc->rx.free, ring_mask), - _ring_free_count(pktio_ipc->rx.free, ring_mask)); + _ODP_DBG("Connected IPC ring: %s, count %d, free %d\n", + ipc_shm_name, _ring_count(pktio_ipc->rx.free, ring_mask), + _ring_free_count(pktio_ipc->rx.free, ring_mask)); snprintf(ipc_shm_name, sizeof(ipc_shm_name), "%s_s_prod", dev); pktio_ipc->tx.send = _ipc_shm_map(ipc_shm_name, pid); if (!pktio_ipc->tx.send) { - ODP_ERR("pid %d unable to find ipc ring %s name\n", - getpid(), dev); + _ODP_ERR("pid %d unable to find ipc ring %s name\n", getpid(), dev); goto free_m_cons; } - ODP_DBG("Connected IPC ring: %s, count %d, free %d\n", - ipc_shm_name, _ring_count(pktio_ipc->tx.send, ring_mask), - _ring_free_count(pktio_ipc->tx.send, ring_mask)); + _ODP_DBG("Connected IPC ring: %s, count %d, free %d\n", + ipc_shm_name, _ring_count(pktio_ipc->tx.send, ring_mask), + _ring_free_count(pktio_ipc->tx.send, ring_mask)); snprintf(ipc_shm_name, sizeof(ipc_shm_name), "%s_s_cons", dev); pktio_ipc->tx.free = _ipc_shm_map(ipc_shm_name, pid); if (!pktio_ipc->tx.free) { - ODP_ERR("pid %d unable to find ipc ring %s name\n", - getpid(), dev); + _ODP_ERR("pid %d unable to find ipc ring %s name\n", getpid(), dev); goto free_s_prod; } - ODP_DBG("Connected IPC ring: %s, count %d, free %d\n", - ipc_shm_name, _ring_count(pktio_ipc->tx.free, ring_mask), - _ring_free_count(pktio_ipc->tx.free, ring_mask)); + _ODP_DBG("Connected IPC ring: %s, count %d, free %d\n", + ipc_shm_name, _ring_count(pktio_ipc->tx.free, ring_mask), + _ring_free_count(pktio_ipc->tx.free, ring_mask)); /* Get info about remote pool */ pinfo = pktio_ipc->pinfo; @@ -506,7 +497,7 @@ static int _ipc_slave_start(pktio_entry_t *pktio_entry) odp_atomic_store_u32(&pktio_ipc->ready, 1); pinfo->slave.init_done = 1; - ODP_DBG("%s started.\n", pktio_entry->name); + _ODP_DBG("%s started.\n", pktio_entry->name); return 0; free_s_prod: @@ -560,7 +551,7 @@ static int ipc_pktio_open(odp_pktio_t id ODP_UNUSED, } pktio_ipc->pinfo = pinfo; pktio_ipc->pinfo_shm = shm; - ODP_DBG("process %d is slave\n", getpid()); + _ODP_DBG("process %d is slave\n", getpid()); ret = _ipc_init_slave(name, pktio_entry, pool); } else { pktio_ipc->type = PKTIO_TYPE_IPC_MASTER; @@ -569,7 +560,7 @@ static int ipc_pktio_open(odp_pktio_t id ODP_UNUSED, ODP_CACHE_LINE_SIZE, ODP_SHM_EXPORT | ODP_SHM_SINGLE_VA); if (ODP_SHM_INVALID == shm) { - ODP_ERR("can not create shm %s\n", name); + _ODP_ERR("can not create shm %s\n", name); return -1; } @@ -579,7 +570,7 @@ static int ipc_pktio_open(odp_pktio_t id ODP_UNUSED, pktio_ipc->pinfo = pinfo; pktio_ipc->pinfo_shm = shm; - ODP_DBG("process %d is master\n", getpid()); + _ODP_DBG("process %d is master\n", getpid()); ret = _ipc_init_master(pktio_entry, dev, pool); } @@ -649,7 +640,7 @@ static int ipc_pktio_recv_lockless(pktio_entry_t *pktio_entry, r = pktio_ipc->rx.cache; pkts = ring_ptr_deq_multi(r, ring_mask, ipcbufs_p, len); if (odp_unlikely(pkts < 0)) - ODP_ABORT("internal error dequeue\n"); + _ODP_ABORT("internal error dequeue\n"); /* rx from other app */ if (pkts == 0) { @@ -658,7 +649,7 @@ static int ipc_pktio_recv_lockless(pktio_entry_t *pktio_entry, pkts = ring_ptr_deq_multi(r, ring_mask, ipcbufs_p, len); if (odp_unlikely(pkts < 0)) - ODP_ABORT("internal error dequeue\n"); + _ODP_ABORT("internal error dequeue\n"); } /* fast path */ @@ -678,7 +669,7 @@ static int ipc_pktio_recv_lockless(pktio_entry_t *pktio_entry, pool = pktio_ipc->pool; if (odp_unlikely(pool == ODP_POOL_INVALID)) - ODP_ABORT("invalid pool"); + _ODP_ABORT("invalid pool"); data_pool_off = (uint8_t *)phdr->seg_data - (uint8_t *)pktio_ipc->remote_base_addr; @@ -700,8 +691,8 @@ static int ipc_pktio_recv_lockless(pktio_entry_t *pktio_entry, /* Copy packet data. */ pkt_data = odp_packet_data(pkt); if (odp_unlikely(!pkt_data)) - ODP_ABORT("unable to map pkt_data ipc_slave %d\n", - (PKTIO_TYPE_IPC_SLAVE == pktio_ipc->type)); + _ODP_ABORT("unable to map pkt_data ipc_slave %d\n", + (PKTIO_TYPE_IPC_SLAVE == pktio_ipc->type)); /* Copy packet data from shared pool to local pool. */ rmt_data_ptr = (uint8_t *)pktio_ipc->pool_mdata_base + @@ -799,7 +790,7 @@ static int ipc_pktio_send_lockless(pktio_entry_t *pktio_entry, newpkt = odp_packet_copy(pkt, pktio_ipc->pool); if (newpkt == ODP_PACKET_INVALID) - ODP_ABORT("Unable to copy packet\n"); + _ODP_ABORT("Unable to copy packet\n"); odp_packet_free(pkt); pkt_table_mapped[i] = newpkt; @@ -870,7 +861,7 @@ static int ipc_start(pktio_entry_t *pktio_entry) uint32_t ready = odp_atomic_load_u32(&pktio_ipc->ready); if (ready) { - ODP_ABORT("%s Already started\n", pktio_entry->name); + _ODP_ABORT("%s Already started\n", pktio_entry->name); return -1; } diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index 695bc477e..947edd476 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -106,7 +106,7 @@ static int loopback_queue_destroy(odp_queue_t queue) } while (event != ODP_EVENT_INVALID); if (odp_queue_destroy(queue)) { - ODP_ERR("Destroying loopback pktio queue failed\n"); + _ODP_ERR("Destroying loopback pktio queue failed\n"); return -1; } return 0; @@ -131,7 +131,7 @@ static int loopback_pktout_queue_config(pktio_entry_t *pktio_entry, pkt_loop->loopq = odp_queue_create(queue_name, &queue_param); if (pkt_loop->loopq == ODP_QUEUE_INVALID) { - ODP_ERR("Creating loopback pktio queue failed\n"); + _ODP_ERR("Creating loopback pktio queue failed\n"); return -1; } @@ -408,7 +408,7 @@ static int loopback_send(pktio_entry_t *pktio_entry, int index ODP_UNUSED, pktio_entry->stats.out_packets += ret; pktio_entry->stats.out_octets += out_octets_tbl[ret - 1]; } else { - ODP_DBG("queue enqueue failed %i\n", ret); + _ODP_DBG("queue enqueue failed %i\n", ret); ret = -1; } @@ -468,7 +468,7 @@ static int loopback_init_capability(pktio_entry_t *pktio_entry) odp_queue_capability_t queue_capa; if (odp_queue_capability(&queue_capa)) { - ODP_ERR("Queue capability failed\n"); + _ODP_ERR("Queue capability failed\n"); return -1; } @@ -579,7 +579,7 @@ static int loopback_pktout_stats(pktio_entry_t *pktio_entry, static int loop_init_global(void) { - ODP_PRINT("PKTIO: initialized loop interface.\n"); + _ODP_PRINT("PKTIO: initialized loop interface.\n"); return 0; } diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c index 6cb3feeb5..41ded2ae1 100644 --- a/platform/linux-generic/pktio/netmap.c +++ b/platform/linux-generic/pktio/netmap.c @@ -142,8 +142,7 @@ static int lookup_opt(const char *opt_name, const char *drv_name, int *val) ret = _odp_libconfig_lookup_ext_int(base, drv_name, opt_name, val); if (ret == 0) - ODP_ERR("Unable to find netmap configuration option: %s\n", - opt_name); + _ODP_ERR("Unable to find netmap configuration option: %s\n", opt_name); return ret; } @@ -157,7 +156,7 @@ static int init_options(pktio_entry_t *pktio_entry) return -1; if (opt->nr_rx_slots < 0 || opt->nr_rx_slots > 4096) { - ODP_ERR("Invalid number of RX slots\n"); + _ODP_ERR("Invalid number of RX slots\n"); return -1; } @@ -166,13 +165,13 @@ static int init_options(pktio_entry_t *pktio_entry) return -1; if (opt->nr_tx_slots < 0 || opt->nr_tx_slots > 4096) { - ODP_ERR("Invalid number of TX slots\n"); + _ODP_ERR("Invalid number of TX slots\n"); return -1; } - ODP_DBG("netmap interface: %s\n", pkt_priv(pktio_entry)->if_name); - ODP_DBG(" num_rx_desc: %d\n", opt->nr_rx_slots); - ODP_DBG(" num_tx_desc: %d\n", opt->nr_tx_slots); + _ODP_DBG("netmap interface: %s\n", pkt_priv(pktio_entry)->if_name); + _ODP_DBG(" num_rx_desc: %d\n", opt->nr_rx_slots); + _ODP_DBG(" num_tx_desc: %d\n", opt->nr_tx_slots); return 0; } @@ -220,7 +219,7 @@ static int netmap_do_ioctl(pktio_entry_t *pktio_entry, unsigned long cmd, } done: if (err) - ODP_ERR("ioctl err %d %lu: %s\n", err, cmd, strerror(errno)); + _ODP_ERR("ioctl err %d %lu: %s\n", err, cmd, strerror(errno)); return err; } @@ -246,7 +245,7 @@ static inline void map_netmap_rings(netmap_ring_t *rings, remainder = num_rings % num_queues; if (remainder) - ODP_DBG("WARNING: Netmap rings mapped unevenly to queues\n"); + _ODP_DBG("WARNING: Netmap rings mapped unevenly to queues\n"); for (i = 0; i < num_queues; i++) { desc_ring = &rings[i]; @@ -283,7 +282,7 @@ static int netmap_input_queues_config(pktio_entry_t *pktio_entry, if (_odp_rss_conf_set_fd(pkt_priv(pktio_entry)->sockfd, pkt_priv(pktio_entry)->if_name, &p->hash_proto)) { - ODP_ERR("Failed to configure input hash\n"); + _ODP_ERR("Failed to configure input hash\n"); return -1; } } @@ -342,7 +341,7 @@ static int netmap_close(pktio_entry_t *pktio_entry) if (pkt_nm->sockfd != -1 && close(pkt_nm->sockfd) != 0) { _odp_errno = errno; - ODP_ERR("close(sockfd): %s\n", strerror(errno)); + _ODP_ERR("close(sockfd): %s\n", strerror(errno)); return -1; } return 0; @@ -407,7 +406,7 @@ static inline int netmap_wait_for_link(pktio_entry_t *pktio_entry) if (ret == 1) return 1; } - ODP_DBG("%s link is down\n", pkt_priv(pktio_entry)->if_name); + _ODP_DBG("%s link is down\n", pkt_priv(pktio_entry)->if_name); return 0; } @@ -430,7 +429,7 @@ static void netmap_init_capability(pktio_entry_t *pktio_entry) /* Have to use a single descriptor to fetch packets from all * netmap rings */ capa->max_input_queues = 1; - ODP_DBG("Unable to store all %" PRIu32 " rx rings (max %d)\n" + _ODP_DBG("Unable to store all %" PRIu32 " rx rings (max %d)\n" " max input queues: %u\n", pkt_nm->num_rx_rings, NM_MAX_DESC, capa->max_input_queues); } @@ -440,7 +439,7 @@ static void netmap_init_capability(pktio_entry_t *pktio_entry) capa->max_output_queues = pkt_nm->num_tx_rings; if (capa->max_output_queues > NM_MAX_DESC) { capa->max_output_queues = NM_MAX_DESC; - ODP_DBG("Unable to store all %" PRIu32 " tx rings (max %d)\n" + _ODP_DBG("Unable to store all %" PRIu32 " tx rings (max %d)\n" " max output queues: %u\n", pkt_nm->num_tx_rings, NM_MAX_DESC, capa->max_output_queues); } @@ -525,14 +524,14 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry, /* Initialize runtime options */ if (init_options(pktio_entry)) { - ODP_ERR("Initializing runtime options failed\n"); + _ODP_ERR("Initializing runtime options failed\n"); return -1; } /* Read netmap buffer size */ nm_buf_size = read_netmap_buf_size(); if (!nm_buf_size) { - ODP_ERR("Unable to read netmap buf size\n"); + _ODP_ERR("Unable to read netmap buf size\n"); return -1; } pkt_nm->mtu_max = _ODP_SOCKET_MTU_MAX; @@ -542,7 +541,7 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry, if (!pkt_nm->is_virtual) { sockfd = socket(AF_INET, SOCK_DGRAM, 0); if (sockfd == -1) { - ODP_ERR("Cannot get device control socket\n"); + _ODP_ERR("Cannot get device control socket\n"); return -1; } pkt_nm->sockfd = sockfd; @@ -551,7 +550,7 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry, * whichever is smaller. */ mtu = _odp_mtu_get_fd(pkt_nm->sockfd, pkt_nm->if_name); if (mtu == 0) { - ODP_ERR("Unable to read interface MTU\n"); + _ODP_ERR("Unable to read interface MTU\n"); goto error; } pkt_nm->mtu = (mtu < nm_buf_size) ? mtu : nm_buf_size; @@ -560,7 +559,7 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry, if (mtu > nm_buf_size) { if (_odp_mtu_set_fd(pkt_nm->sockfd, pkt_nm->if_name, nm_buf_size)) { - ODP_ERR("Unable to set interface MTU\n"); + _ODP_ERR("Unable to set interface MTU\n"); goto error; } } @@ -569,7 +568,7 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry, * capability info. */ desc = nm_open(pkt_nm->nm_name, NULL, 0, NULL); if (desc == NULL) { - ODP_ERR("nm_open(%s) failed\n", pkt_nm->nm_name); + _ODP_ERR("nm_open(%s) failed\n", pkt_nm->nm_name); goto error; } pkt_nm->num_rx_rings = desc->nifp->ni_rx_rings; @@ -589,7 +588,7 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry, uint32_t tid = syscall(SYS_gettid); if ((int)tid == -1) - ODP_DBG("Unable to fetch thread ID. VALE port MAC " + _ODP_DBG("Unable to fetch thread ID. VALE port MAC " "addresses may not be unique.\n"); pktio_entry->capa.max_input_queues = 1; @@ -611,7 +610,7 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry, /* Check if RSS is supported. If not, set 'max_input_queues' to 1. */ if (_odp_rss_conf_get_supported_fd(pkt_nm->sockfd, netdev, &hash_proto) == 0) { - ODP_DBG("RSS not supported\n"); + _ODP_DBG("RSS not supported\n"); pktio_entry->capa.max_input_queues = 1; } @@ -619,7 +618,7 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry, if (err) goto error; if ((pkt_nm->if_flags & IFF_UP) == 0) - ODP_DBG("%s is down\n", pkt_nm->if_name); + _ODP_DBG("%s is down\n", pkt_nm->if_name); err = _odp_mac_addr_get_fd(pkt_nm->sockfd, netdev, pkt_nm->if_mac); if (err) @@ -628,8 +627,8 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry, /* netmap uses only ethtool to get statistics counters */ err = _odp_ethtool_stats_get_fd(pkt_nm->sockfd, pkt_nm->if_name, &cur_stats); if (err) { - ODP_DBG("netmap pktio %s does not support statistics counters\n", - pkt_nm->if_name); + _ODP_DBG("netmap pktio %s does not support statistics counters\n", + pkt_nm->if_name); pktio_entry->stats_type = STATS_UNSUPPORTED; } else { pktio_entry->stats_type = STATS_ETHTOOL; @@ -703,7 +702,7 @@ static int netmap_start(pktio_entry_t *pktio_entry) /* Use nm_open() to parse netmap flags from interface name */ desc_ptr = nm_open(pkt_nm->nm_name, NULL, 0, NULL); if (desc_ptr == NULL) { - ODP_ERR("nm_start(%s) failed\n", pkt_nm->nm_name); + _ODP_ERR("nm_start(%s) failed\n", pkt_nm->nm_name); goto error; } struct nm_desc base_desc = *desc_ptr; @@ -736,7 +735,7 @@ static int netmap_start(pktio_entry_t *pktio_entry) desc_ring[0].desc[0] = nm_open(pkt_nm->nm_name, NULL, flags, &base_desc); if (desc_ring[0].desc[0] == NULL) { - ODP_ERR("nm_start(%s) failed\n", pkt_nm->nm_name); + _ODP_ERR("nm_start(%s) failed\n", pkt_nm->nm_name); goto error; } /* Open rest of the rx descriptors (one per netmap ring) */ @@ -755,8 +754,7 @@ static int netmap_start(pktio_entry_t *pktio_entry) desc_ring[i].desc[j] = nm_open(pkt_nm->nm_name, NULL, flags, &base_desc); if (desc_ring[i].desc[j] == NULL) { - ODP_ERR("nm_start(%s) failed\n", - pkt_nm->nm_name); + _ODP_ERR("nm_start(%s) failed\n", pkt_nm->nm_name); goto error; } } @@ -778,8 +776,7 @@ static int netmap_start(pktio_entry_t *pktio_entry) desc_ring[i].desc[j] = nm_open(pkt_nm->nm_name, NULL, flags, &base_desc); if (desc_ring[i].desc[j] == NULL) { - ODP_ERR("nm_start(%s) failed\n", - pkt_nm->nm_name); + _ODP_ERR("nm_start(%s) failed\n", pkt_nm->nm_name); goto error; } } @@ -934,7 +931,7 @@ static inline int netmap_recv_desc(pktio_entry_t *pktio_entry, slot_tbl[num_rx].len = ring->slot[slot_id].len; num_rx++; } else { - ODP_DBG("Dropped oversized packet: %" PRIu16 " " + _ODP_DBG("Dropped oversized packet: %" PRIu16 " " "B\n", ring->slot[slot_id].len); } ring->cur = nm_ring_next(ring, slot_id); @@ -1031,7 +1028,7 @@ static int netmap_recv(pktio_entry_t *pktio_entry, int index, struct timeval tout = {.tv_sec = 0, .tv_usec = 0}; if (select(max_fd + 1, &empty_rings, NULL, NULL, &tout) == -1) - ODP_ERR("RX: select error\n"); + _ODP_ERR("RX: select error\n"); } if (!pkt_nm->lockless_rx) odp_ticketlock_unlock(&pkt_nm->rx_desc_ring[index].lock); @@ -1293,11 +1290,11 @@ static void netmap_print(pktio_entry_t *pktio_entry) static int netmap_init_global(void) { if (getenv("ODP_PKTIO_DISABLE_NETMAP")) { - ODP_PRINT("PKTIO: netmap pktio skipped," + _ODP_PRINT("PKTIO: netmap pktio skipped," " enabled export ODP_PKTIO_DISABLE_NETMAP=1.\n"); disable_pktio = 1; } else { - ODP_PRINT("PKTIO: initialized netmap pktio," + _ODP_PRINT("PKTIO: initialized netmap pktio," " use export ODP_PKTIO_DISABLE_NETMAP=1 to disable.\n" " Netmap prefixes are netmap:eth0 or vale:eth0. Refer to" " Netmap documentation for usage information.\n"); diff --git a/platform/linux-generic/pktio/null.c b/platform/linux-generic/pktio/null.c index d6060dc73..0bd33f517 100644 --- a/platform/linux-generic/pktio/null.c +++ b/platform/linux-generic/pktio/null.c @@ -157,7 +157,7 @@ static int null_outqueues_config(pktio_entry_t *pktio_entry ODP_UNUSED, static int null_init_global(void) { - ODP_PRINT("PKTIO: initialized null interface.\n"); + _ODP_PRINT("PKTIO: initialized null interface.\n"); return 0; } diff --git a/platform/linux-generic/pktio/pcap.c b/platform/linux-generic/pktio/pcap.c index 768f876f5..20b6ec179 100644 --- a/platform/linux-generic/pktio/pcap.c +++ b/platform/linux-generic/pktio/pcap.c @@ -109,7 +109,7 @@ static int _pcapif_parse_devname(pkt_pcap_t *pcap, const char *devname) } else if (strncmp(tok, "loops=", 6) == 0) { pcap->loops = atoi(tok + 6); if (pcap->loops < 0) { - ODP_ERR("invalid loop count\n"); + _ODP_ERR("invalid loop count\n"); return -1; } } @@ -125,14 +125,13 @@ static int _pcapif_init_rx(pkt_pcap_t *pcap) pcap->rx = pcap_open_offline(pcap->fname_rx, errbuf); if (!pcap->rx) { - ODP_ERR("failed to open pcap file %s (%s)\n", - pcap->fname_rx, errbuf); + _ODP_ERR("failed to open pcap file %s (%s)\n", pcap->fname_rx, errbuf); return -1; } linktype = pcap_datalink(pcap->rx); if (linktype != DLT_EN10MB) { - ODP_ERR("unsupported datalink type: %d\n", linktype); + _ODP_ERR("unsupported datalink type: %d\n", linktype); return -1; } @@ -148,7 +147,7 @@ static int _pcapif_init_tx(pkt_pcap_t *pcap) * one needs to be opened for writing the dump */ tx = pcap_open_dead(DLT_EN10MB, PKTIO_PCAP_MTU_MAX); if (!tx) { - ODP_ERR("failed to open TX dump\n"); + _ODP_ERR("failed to open TX dump\n"); return -1; } @@ -157,8 +156,7 @@ static int _pcapif_init_tx(pkt_pcap_t *pcap) pcap->tx_dump = pcap_dump_open(tx, pcap->fname_tx); if (!pcap->tx_dump) { - ODP_ERR("failed to open dump file %s (%s)\n", - pcap->fname_tx, pcap_geterr(tx)); + _ODP_ERR("failed to open dump file %s (%s)\n", pcap->fname_tx, pcap_geterr(tx)); return -1; } @@ -192,14 +190,12 @@ static int pcapif_promisc_mode_set(pktio_entry_t *pktio_entry, if (pcap_compile(pcap->rx, &bpf, filter_exp, 0, PCAP_NETMASK_UNKNOWN) != 0) { - ODP_ERR("failed to compile promisc mode filter: %s\n", - pcap_geterr(pcap->rx)); + _ODP_ERR("failed to compile promisc mode filter: %s\n", pcap_geterr(pcap->rx)); return -1; } if (pcap_setfilter(pcap->rx, &bpf) != 0) { - ODP_ERR("failed to set promisc mode filter: %s\n", - pcap_geterr(pcap->rx)); + _ODP_ERR("failed to set promisc mode filter: %s\n", pcap_geterr(pcap->rx)); return -1; } @@ -274,8 +270,7 @@ static int _pcapif_reopen(pkt_pcap_t *pcap) pcap->rx = pcap_open_offline(pcap->fname_rx, errbuf); if (!pcap->rx) { - ODP_ERR("failed to reopen pcap file %s (%s)\n", - pcap->fname_rx, errbuf); + _ODP_ERR("failed to reopen pcap file %s (%s)\n", pcap->fname_rx, errbuf); return 1; } @@ -336,7 +331,7 @@ static int pcapif_recv_pkt(pktio_entry_t *pktio_entry, int index ODP_UNUSED, pull_head(pkt_hdr, frame_offset); if (odp_packet_copy_from_mem(pkt, 0, pkt_len, data) != 0) { - ODP_ERR("failed to copy packet data\n"); + _ODP_ERR("failed to copy packet data\n"); break; } @@ -530,7 +525,7 @@ static int pcapif_stats(pktio_entry_t *pktio_entry, static int pcapif_init_global(void) { - ODP_PRINT("PKTIO: initialized pcap interface.\n"); + _ODP_PRINT("PKTIO: initialized pcap interface.\n"); return 0; } diff --git a/platform/linux-generic/pktio/pktio_common.c b/platform/linux-generic/pktio/pktio_common.c index 5eaf40c33..097b8cf29 100644 --- a/platform/linux-generic/pktio/pktio_common.c +++ b/platform/linux-generic/pktio/pktio_common.c @@ -72,8 +72,8 @@ int _odp_sock_recv_mq_tmo_try_int_driven(const struct odp_pktin_queue_t queues[] entry[i] = get_pktio_entry(queues[i].pktio); index[i] = queues[i].index; if (entry[i] == NULL) { - ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", - (uintptr_t)queues[i].pktio); + _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n", + (uintptr_t)queues[i].pktio); *trial_successful = 0; return -1; } diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c index 4ceb5151e..97574186c 100644 --- a/platform/linux-generic/pktio/socket.c +++ b/platform/linux-generic/pktio/socket.c @@ -97,7 +97,7 @@ static int sock_close(pktio_entry_t *pktio_entry) if (pkt_sock->sockfd != -1 && close(pkt_sock->sockfd) != 0) { _odp_errno = errno; - ODP_ERR("close(sockfd): %s\n", strerror(errno)); + _ODP_ERR("close(sockfd): %s\n", strerror(errno)); return -1; } @@ -129,7 +129,7 @@ static int sock_setup_pkt(pktio_entry_t *pktio_entry, const char *netdev, sockfd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); if (sockfd == -1) { _odp_errno = errno; - ODP_ERR("socket(): %s\n", strerror(errno)); + _ODP_ERR("socket(): %s\n", strerror(errno)); goto error; } pkt_sock->sockfd = sockfd; @@ -140,8 +140,7 @@ static int sock_setup_pkt(pktio_entry_t *pktio_entry, const char *netdev, err = ioctl(sockfd, SIOCGIFINDEX, ðreq); if (err != 0) { _odp_errno = errno; - ODP_ERR("ioctl(SIOCGIFINDEX): %s: \"%s\".\n", strerror(errno), - ethreq.ifr_name); + _ODP_ERR("ioctl(SIOCGIFINDEX): %s: \"%s\".\n", strerror(errno), ethreq.ifr_name); goto error; } if_idx = ethreq.ifr_ifindex; @@ -164,14 +163,14 @@ static int sock_setup_pkt(pktio_entry_t *pktio_entry, const char *netdev, sa_ll.sll_protocol = htons(ETH_P_ALL); if (bind(sockfd, (struct sockaddr *)&sa_ll, sizeof(sa_ll)) < 0) { _odp_errno = errno; - ODP_ERR("bind(to IF): %s\n", strerror(errno)); + _ODP_ERR("bind(to IF): %s\n", strerror(errno)); goto error; } pktio_entry->stats_type = _odp_sock_stats_type_fd(pktio_entry, pkt_sock->sockfd); if (pktio_entry->stats_type == STATS_UNSUPPORTED) - ODP_DBG("pktio: %s unsupported stats\n", pktio_entry->name); + _ODP_DBG("pktio: %s unsupported stats\n", pktio_entry->name); err = sock_stats_reset(pktio_entry); if (err != 0) @@ -268,14 +267,14 @@ static int sock_mmsg_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED, if (odp_unlikely(msgvec[i].msg_hdr.msg_flags & MSG_TRUNC)) { odp_packet_free(pkt); - ODP_DBG("dropped truncated packet\n"); + _ODP_DBG("dropped truncated packet\n"); continue; } ret = odp_packet_trunc_tail(&pkt, odp_packet_len(pkt) - pkt_len, NULL, NULL); if (ret < 0) { - ODP_ERR("trunc_tail failed"); + _ODP_ERR("trunc_tail failed"); odp_packet_free(pkt); continue; } @@ -488,7 +487,7 @@ static int sock_mmsg_send(pktio_entry_t *pktio_entry, int index ODP_UNUSED, if (odp_unlikely(ret <= -1)) { if (i == 0 && SOCK_ERR_REPORT(errno)) { _odp_errno = errno; - ODP_ERR("sendmmsg(): %s\n", strerror(errno)); + _ODP_ERR("sendmmsg(): %s\n", strerror(errno)); odp_ticketlock_unlock(&pkt_sock->tx_lock); return -1; } @@ -625,11 +624,11 @@ static int sock_extra_stat_counter(pktio_entry_t *pktio_entry, uint32_t id, static int sock_init_global(void) { if (getenv("ODP_PKTIO_DISABLE_SOCKET_MMSG")) { - ODP_PRINT("PKTIO: socket mmsg skipped," + _ODP_PRINT("PKTIO: socket mmsg skipped," " enabled export ODP_PKTIO_DISABLE_SOCKET_MMSG=1.\n"); disable_pktio = 1; } else { - ODP_PRINT("PKTIO: initialized socket mmsg," + _ODP_PRINT("PKTIO: initialized socket mmsg," " use export ODP_PKTIO_DISABLE_SOCKET_MMSG=1 to disable.\n"); } return 0; diff --git a/platform/linux-generic/pktio/socket_common.c b/platform/linux-generic/pktio/socket_common.c index ab0caeb81..b6ae7b9ae 100644 --- a/platform/linux-generic/pktio/socket_common.c +++ b/platform/linux-generic/pktio/socket_common.c @@ -58,8 +58,7 @@ int _odp_mac_addr_get_fd(int fd, const char *name, unsigned char mac_dst[]) ret = ioctl(fd, SIOCGIFHWADDR, ðreq); if (ret != 0) { _odp_errno = errno; - ODP_ERR("ioctl(SIOCGIFHWADDR): %s: \"%s\".\n", strerror(errno), - ethreq.ifr_name); + _ODP_ERR("ioctl(SIOCGIFHWADDR): %s: \"%s\".\n", strerror(errno), ethreq.ifr_name); return -1; } @@ -83,8 +82,7 @@ uint32_t _odp_mtu_get_fd(int fd, const char *name) ret = ioctl(fd, SIOCGIFMTU, &ifr); if (ret < 0) { _odp_errno = errno; - ODP_ERR("ioctl(SIOCGIFMTU): %s: \"%s\".\n", strerror(errno), - ifr.ifr_name); + _ODP_ERR("ioctl(SIOCGIFMTU): %s: \"%s\".\n", strerror(errno), ifr.ifr_name); return 0; } return ifr.ifr_mtu + _ODP_ETHHDR_LEN; @@ -107,8 +105,7 @@ int _odp_mtu_set_fd(int fd, const char *name, int mtu) ret = ioctl(fd, SIOCSIFMTU, &ifr); if (ret < 0) { _odp_errno = errno; - ODP_ERR("ioctl(SIOCSIFMTU): %s: \"%s\".\n", strerror(errno), - ifr.ifr_name); + _ODP_ERR("ioctl(SIOCSIFMTU): %s: \"%s\".\n", strerror(errno), ifr.ifr_name); return -1; } return 0; @@ -128,8 +125,7 @@ int _odp_promisc_mode_set_fd(int fd, const char *name, int enable) ret = ioctl(fd, SIOCGIFFLAGS, &ifr); if (ret < 0) { _odp_errno = errno; - ODP_DBG("ioctl(SIOCGIFFLAGS): %s: \"%s\".\n", strerror(errno), - ifr.ifr_name); + _ODP_DBG("ioctl(SIOCGIFFLAGS): %s: \"%s\".\n", strerror(errno), ifr.ifr_name); return -1; } @@ -141,8 +137,7 @@ int _odp_promisc_mode_set_fd(int fd, const char *name, int enable) ret = ioctl(fd, SIOCSIFFLAGS, &ifr); if (ret < 0) { _odp_errno = errno; - ODP_DBG("ioctl(SIOCSIFFLAGS): %s: \"%s\".\n", strerror(errno), - ifr.ifr_name); + _ODP_DBG("ioctl(SIOCSIFFLAGS): %s: \"%s\".\n", strerror(errno), ifr.ifr_name); return -1; } return 0; @@ -162,8 +157,7 @@ int _odp_promisc_mode_get_fd(int fd, const char *name) ret = ioctl(fd, SIOCGIFFLAGS, &ifr); if (ret < 0) { _odp_errno = errno; - ODP_DBG("ioctl(SIOCGIFFLAGS): %s: \"%s\".\n", strerror(errno), - ifr.ifr_name); + _ODP_DBG("ioctl(SIOCGIFFLAGS): %s: \"%s\".\n", strerror(errno), ifr.ifr_name); return -1; } @@ -179,8 +173,7 @@ int _odp_link_status_fd(int fd, const char *name) ret = ioctl(fd, SIOCGIFFLAGS, &ifr); if (ret < 0) { _odp_errno = errno; - ODP_DBG("ioctl(SIOCGIFFLAGS): %s: \"%s\".\n", strerror(errno), - ifr.ifr_name); + _ODP_DBG("ioctl(SIOCGIFFLAGS): %s: \"%s\".\n", strerror(errno), ifr.ifr_name); return ODP_PKTIO_LINK_STATUS_UNKNOWN; } @@ -207,8 +200,7 @@ int _odp_link_info_fd(int fd, const char *name, odp_pktio_link_info_t *info) ifr.ifr_data = (void *)&pcmd; if (ioctl(fd, SIOCETHTOOL, &ifr) && errno != EOPNOTSUPP) { _odp_errno = errno; - ODP_ERR("ioctl(SIOCETHTOOL): %s: \"%s\".\n", strerror(errno), - ifr.ifr_name); + _ODP_ERR("ioctl(SIOCETHTOOL): %s: \"%s\".\n", strerror(errno), ifr.ifr_name); return -1; } @@ -220,7 +212,8 @@ int _odp_link_info_fd(int fd, const char *name, odp_pktio_link_info_t *info) ifr.ifr_data = (void *)&ecmd_old; if (ioctl(fd, SIOCETHTOOL, &ifr) < 0) { _odp_errno = errno; - ODP_ERR("ioctl(SIOCETHTOOL): %s: \"%s\".\n", strerror(errno), ifr.ifr_name); + _ODP_ERR("ioctl(SIOCETHTOOL): %s: \"%s\".\n", strerror(errno), + ifr.ifr_name); return -1; } @@ -261,7 +254,7 @@ int _odp_link_info_fd(int fd, const char *name, odp_pktio_link_info_t *info) } if (hcmd.link_mode_masks_nwords >= 0 || hcmd.cmd != ETHTOOL_GLINKSETTINGS) { - ODP_ERR("ETHTOOL_GLINKSETTINGS handshake failed\n"); + _ODP_ERR("ETHTOOL_GLINKSETTINGS handshake failed\n"); return -1; } /* Absolute value indicates kernel recommended 'link_mode_masks_nwords' value. */ @@ -278,8 +271,7 @@ int _odp_link_info_fd(int fd, const char *name, odp_pktio_link_info_t *info) ifr.ifr_data = (void *)ecmd; if (ioctl(fd, SIOCETHTOOL, &ifr) < 0) { _odp_errno = errno; - ODP_ERR("ioctl(SIOCETHTOOL): %s: \"%s\".\n", strerror(errno), - ifr.ifr_name); + _ODP_ERR("ioctl(SIOCETHTOOL): %s: \"%s\".\n", strerror(errno), ifr.ifr_name); return -1; } diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index 4e1bf8527..ea6c0b9b7 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -114,14 +114,14 @@ static int mmap_pkt_socket(void) if (sock == -1) { _odp_errno = errno; - ODP_ERR("socket(SOCK_RAW): %s\n", strerror(errno)); + _ODP_ERR("socket(SOCK_RAW): %s\n", strerror(errno)); return -1; } ret = setsockopt(sock, SOL_PACKET, PACKET_VERSION, &ver, sizeof(ver)); if (ret == -1) { _odp_errno = errno; - ODP_ERR("setsockopt(PACKET_VERSION): %s\n", strerror(errno)); + _ODP_ERR("setsockopt(PACKET_VERSION): %s\n", strerror(errno)); close(sock); return -1; } @@ -187,7 +187,7 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, if (odp_unlikely(pkt_len > pkt_sock->mtu)) { tp_hdr->tp_status = TP_STATUS_KERNEL; frame_num = next_frame_num; - ODP_DBG("dropped oversized packet\n"); + _ODP_DBG("dropped oversized packet\n"); continue; } @@ -251,7 +251,7 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, static int warning_printed; if (warning_printed == 0) { - ODP_DBG("Original TPID value lost. Using 0x8100 for single tagged and 0x88a8 for double tagged.\n"); + _ODP_DBG("Original TPID value lost. Using 0x8100 for single tagged and 0x88a8 for double tagged.\n"); warning_printed = 1; } type2 = (uint16_t *)(uintptr_t)(mac + (2 * _ODP_ETHADDR_LEN) + vlan_len); @@ -347,7 +347,7 @@ static inline int pkt_mmap_v2_tx(pktio_entry_t *pktio_entry, int sock, if (tp_status != TP_STATUS_AVAILABLE) { if (tp_status == TP_STATUS_WRONG_FORMAT) { - ODP_ERR("Socket mmap: wrong format\n"); + _ODP_ERR("Socket mmap: wrong format\n"); return -1; } @@ -389,8 +389,7 @@ static inline int pkt_mmap_v2_tx(pktio_entry_t *pktio_entry, int sock, /* Returns -1 when nothing is sent (send() would block) */ if (ret < 0 && errno != EWOULDBLOCK) { - ODP_ERR("Socket mmap: send failed, ret %i, errno %i\n", - ret, errno); + _ODP_ERR("Socket mmap: send failed, ret %i, errno %i\n", ret, errno); return -1; } @@ -404,7 +403,7 @@ static inline int pkt_mmap_v2_tx(pktio_entry_t *pktio_entry, int sock, break; if (tp_status == TP_STATUS_WRONG_FORMAT) { - ODP_ERR("Socket mmap: wrong format\n"); + _ODP_ERR("Socket mmap: wrong format\n"); break; } } @@ -462,7 +461,7 @@ static int mmap_setup_ring(pkt_sock_mmap_t *pkt_sock, struct ring *ring, shm = odp_shm_reserve(NULL, ring_size, ODP_CACHE_LINE_SIZE, flags); if (shm == ODP_SHM_INVALID) { - ODP_ERR("Reserving shm failed\n"); + _ODP_ERR("Reserving shm failed\n"); return -1; } ring->shm = shm; @@ -477,21 +476,21 @@ static int mmap_setup_ring(pkt_sock_mmap_t *pkt_sock, struct ring *ring, ring->flen = ring->req.tp_frame_size; ring->rd_len = ring_size; - ODP_DBG(" tp_block_size %u\n", ring->req.tp_block_size); - ODP_DBG(" tp_block_nr %u\n", ring->req.tp_block_nr); - ODP_DBG(" tp_frame_size %u\n", ring->req.tp_frame_size); - ODP_DBG(" tp_frame_nr %u\n", ring->req.tp_frame_nr); + _ODP_DBG(" tp_block_size %u\n", ring->req.tp_block_size); + _ODP_DBG(" tp_block_nr %u\n", ring->req.tp_block_nr); + _ODP_DBG(" tp_frame_size %u\n", ring->req.tp_frame_size); + _ODP_DBG(" tp_frame_nr %u\n", ring->req.tp_frame_nr); ret = setsockopt(sock, SOL_PACKET, type, &ring->req, sizeof(ring->req)); if (ret == -1) { _odp_errno = errno; - ODP_ERR("setsockopt(pkt mmap): %s\n", strerror(errno)); + _ODP_ERR("setsockopt(pkt mmap): %s\n", strerror(errno)); return -1; } ring->rd = odp_shm_addr(shm); if (!ring->rd) { - ODP_ERR("Reading shm addr failed\n"); + _ODP_ERR("Reading shm addr failed\n"); return -1; } @@ -516,7 +515,7 @@ static int mmap_sock(pkt_sock_mmap_t *pkt_sock) if (pkt_sock->mmap_base == MAP_FAILED) { _odp_errno = errno; - ODP_ERR("mmap rx&tx buffer failed: %s\n", strerror(errno)); + _ODP_ERR("mmap rx&tx buffer failed: %s\n", strerror(errno)); return -1; } @@ -572,7 +571,7 @@ static int mmap_bind_sock(pkt_sock_mmap_t *pkt_sock, const char *netdev) sizeof(pkt_sock->ll)); if (ret == -1) { _odp_errno = errno; - ODP_ERR("bind(to IF): %s\n", strerror(errno)); + _ODP_ERR("bind(to IF): %s\n", strerror(errno)); return -1; } @@ -586,13 +585,13 @@ static int sock_mmap_close(pktio_entry_t *entry) ret = mmap_unmap_sock(pkt_sock); if (ret != 0) { - ODP_ERR("mmap_unmap_sock() %s\n", strerror(errno)); + _ODP_ERR("mmap_unmap_sock() %s\n", strerror(errno)); return -1; } if (pkt_sock->sockfd != -1 && close(pkt_sock->sockfd) != 0) { _odp_errno = errno; - ODP_ERR("close(sockfd): %s\n", strerror(errno)); + _ODP_ERR("close(sockfd): %s\n", strerror(errno)); return -1; } @@ -643,14 +642,14 @@ static int sock_mmap_open(odp_pktio_t id ODP_UNUSED, if (pkt_sock->mtu > _ODP_SOCKET_MTU_MAX) pkt_sock->mtu_max = pkt_sock->mtu; - ODP_DBG("MTU size: %i\n", pkt_sock->mtu); + _ODP_DBG("MTU size: %i\n", pkt_sock->mtu); - ODP_DBG("TX ring setup:\n"); + _ODP_DBG("TX ring setup:\n"); ret = mmap_setup_ring(pkt_sock, &pkt_sock->tx_ring, PACKET_TX_RING); if (ret != 0) goto error; - ODP_DBG("RX ring setup:\n"); + _ODP_DBG("RX ring setup:\n"); ret = mmap_setup_ring(pkt_sock, &pkt_sock->rx_ring, PACKET_RX_RING); if (ret != 0) goto error; @@ -666,14 +665,14 @@ static int sock_mmap_open(odp_pktio_t id ODP_UNUSED, if_idx = if_nametoindex(netdev); if (if_idx == 0) { _odp_errno = errno; - ODP_ERR("if_nametoindex(): %s\n", strerror(errno)); + _ODP_ERR("if_nametoindex(): %s\n", strerror(errno)); goto error; } pktio_entry->stats_type = _odp_sock_stats_type_fd(pktio_entry, pkt_sock->sockfd); if (pktio_entry->stats_type == STATS_UNSUPPORTED) - ODP_DBG("pktio: %s unsupported stats\n", pktio_entry->name); + _ODP_DBG("pktio: %s unsupported stats\n", pktio_entry->name); ret = _odp_sock_stats_reset_fd(pktio_entry, pkt_priv(pktio_entry)->sockfd); @@ -934,11 +933,11 @@ static int sock_mmap_extra_stat_counter(pktio_entry_t *pktio_entry, uint32_t id, static int sock_mmap_init_global(void) { if (getenv("ODP_PKTIO_DISABLE_SOCKET_MMAP")) { - ODP_PRINT("PKTIO: socket mmap skipped," + _ODP_PRINT("PKTIO: socket mmap skipped," " enabled export ODP_PKTIO_DISABLE_SOCKET_MMAP=1.\n"); disable_pktio = 1; } else { - ODP_PRINT("PKTIO: initialized socket mmap," + _ODP_PRINT("PKTIO: initialized socket mmap," " use export ODP_PKTIO_DISABLE_SOCKET_MMAP=1 to disable.\n"); } return 0; diff --git a/platform/linux-generic/pktio/socket_xdp.c b/platform/linux-generic/pktio/socket_xdp.c index 2b4abf66c..dc865eeb1 100644 --- a/platform/linux-generic/pktio/socket_xdp.c +++ b/platform/linux-generic/pktio/socket_xdp.c @@ -121,11 +121,11 @@ static odp_bool_t disable_pktio; static int sock_xdp_init_global(void) { if (getenv("ODP_PKTIO_DISABLE_SOCKET_XDP")) { - ODP_PRINT("PKTIO: socket xdp skipped," + _ODP_PRINT("PKTIO: socket xdp skipped," " enabled export ODP_PKTIO_DISABLE_SOCKET_XDP=1.\n"); disable_pktio = true; } else { - ODP_PRINT("PKTIO: initialized socket xdp," + _ODP_PRINT("PKTIO: initialized socket xdp," " use export ODP_PKTIO_DISABLE_SOCKET_XDP=1 to disable.\n"); } @@ -143,16 +143,16 @@ static void parse_options(xdp_umem_info_t *umem_info) &umem_info->num_rx_desc) || !_odp_libconfig_lookup_ext_int(CONF_BASE_STR, NULL, TX_DESCS_STR, &umem_info->num_tx_desc)) { - ODP_ERR("Unable to parse xdp descriptor configuration, using defaults (%d).\n", - NUM_DESCS_DEFAULT); + _ODP_ERR("Unable to parse xdp descriptor configuration, using defaults (%d).\n", + NUM_DESCS_DEFAULT); goto defaults; } if (umem_info->num_rx_desc <= 0 || umem_info->num_tx_desc <= 0 || !_ODP_CHECK_IS_POWER2(umem_info->num_rx_desc) || !_ODP_CHECK_IS_POWER2(umem_info->num_tx_desc)) { - ODP_ERR("Invalid xdp descriptor configuration, using defaults (%d).\n", - NUM_DESCS_DEFAULT); + _ODP_ERR("Invalid xdp descriptor configuration, using defaults (%d).\n", + NUM_DESCS_DEFAULT); goto defaults; } @@ -251,7 +251,7 @@ static int sock_xdp_open(odp_pktio_t pktio, pktio_entry_t *pktio_entry, const ch ret = umem_create(priv->umem_info, pool); if (ret) { - ODP_ERR("Error creating UMEM pool for xdp: %d\n", ret); + _ODP_ERR("Error creating UMEM pool for xdp: %d\n", ret); return -1; } @@ -263,7 +263,7 @@ static int sock_xdp_open(odp_pktio_t pktio, pktio_entry_t *pktio_entry, const ch ret = socket(AF_INET, SOCK_DGRAM, 0); if (ret == -1) { - ODP_ERR("Error creating helper socket for xdp: %s\n", strerror(errno)); + _ODP_ERR("Error creating helper socket for xdp: %s\n", strerror(errno)); goto sock_err; } @@ -282,10 +282,10 @@ static int sock_xdp_open(odp_pktio_t pktio, pktio_entry_t *pktio_entry, const ch priv->bind_q = get_bind_queue_index(pktio_entry->name); - ODP_DBG("Socket xdp interface (%s):\n", pktio_entry->name); - ODP_DBG(" num_rx_desc: %d\n", priv->umem_info->num_rx_desc); - ODP_DBG(" num_tx_desc: %d\n", priv->umem_info->num_tx_desc); - ODP_DBG(" starting bind queue: %u\n", priv->bind_q); + _ODP_DBG("Socket xdp interface (%s):\n", pktio_entry->name); + _ODP_DBG(" num_rx_desc: %d\n", priv->umem_info->num_rx_desc); + _ODP_DBG(" num_tx_desc: %d\n", priv->umem_info->num_tx_desc); + _ODP_DBG(" starting bind queue: %u\n", priv->bind_q); return 0; @@ -465,7 +465,7 @@ static int sock_xdp_extra_stat_counter(pktio_entry_t *pktio_entry, uint32_t id, const uint32_t total_stats = MAX_INTERNAL_STATS * priv->num_q; if (id >= total_stats) { - ODP_ERR("Invalid counter id: %u (allowed range: 0-%u)\n", id, total_stats - 1U); + _ODP_ERR("Invalid counter id: %u (allowed range: 0-%u)\n", id, total_stats - 1U); return -1; } @@ -845,7 +845,7 @@ static int set_queue_capability(int fd, const char *devname, odp_pktio_capabilit if (ret == -1 || channels.max_combined == 0U) { if (ret == -1 && errno != EOPNOTSUPP) { - ODP_ERR("Unable to query NIC channel capabilities: %s\n", strerror(errno)); + _ODP_ERR("Unable to query NIC channel capabilities: %s\n", strerror(errno)); return -1; } @@ -940,15 +940,15 @@ static int sock_xdp_output_queues_config(pktio_entry_t *pktio_entry, &sock->tx, &sock->fill_q, &sock->compl_q, &config); if (ret) { - ODP_ERR("Error creating xdp socket for bind queue %u: %d\n", bind_q, ret); + _ODP_ERR("Error creating xdp socket for bind queue %u: %d\n", bind_q, ret); goto err; } ++i; if (!reserve_fill_queue_elements(priv, sock, config.rx_size)) { - ODP_ERR("Unable to reserve fill queue descriptors for queue: %u.\n", - bind_q); + _ODP_ERR("Unable to reserve fill queue descriptors for queue: %u.\n", + bind_q); goto err; } @@ -1032,8 +1032,8 @@ static void sock_xdp_adjust_block_size(uint8_t *data ODP_UNUSED, uint32_t *block return; if (size > ps) { - ODP_ERR("Adjusted pool block size larger than page size: %u > %" PRIu64 "\n", - size, ps); + _ODP_ERR("Adjusted pool block size larger than page size: %u > %" PRIu64 "\n", + size, ps); *block_size = 0U; } diff --git a/platform/linux-generic/pktio/stats/ethtool_stats.c b/platform/linux-generic/pktio/stats/ethtool_stats.c index f300ed0ba..678ec45ee 100644 --- a/platform/linux-generic/pktio/stats/ethtool_stats.c +++ b/platform/linux-generic/pktio/stats/ethtool_stats.c @@ -51,7 +51,7 @@ static struct ethtool_gstrings *get_stringset(int fd, struct ifreq *ifr) ifr->ifr_data = (void *)&drvinfo; if (ioctl(fd, SIOCETHTOOL, ifr)) { _odp_errno = errno; - ODP_ERR("Cannot get stats information\n"); + _ODP_ERR("Cannot get stats information\n"); return NULL; } len = *(uint32_t *)(void *)((char *)&drvinfo + drvinfo_offset); @@ -61,13 +61,13 @@ static struct ethtool_gstrings *get_stringset(int fd, struct ifreq *ifr) } if (!len) { - ODP_ERR("len is zero"); + _ODP_ERR("len is zero"); return NULL; } strings = calloc(1, sizeof(*strings) + len * ETH_GSTRING_LEN); if (!strings) { - ODP_ERR("alloc failed\n"); + _ODP_ERR("alloc failed\n"); return NULL; } @@ -77,7 +77,7 @@ static struct ethtool_gstrings *get_stringset(int fd, struct ifreq *ifr) ifr->ifr_data = (void *)strings; if (ioctl(fd, SIOCETHTOOL, ifr)) { _odp_errno = errno; - ODP_ERR("Cannot get stats information\n"); + _ODP_ERR("Cannot get stats information\n"); free(strings); return NULL; } @@ -105,7 +105,7 @@ static int ethtool_stats_get(int fd, const char *name, n_stats = strings->len; if (n_stats < 1) { - ODP_ERR("no stats available\n"); + _ODP_ERR("no stats available\n"); free(strings); return -1; } @@ -272,7 +272,7 @@ int _odp_ethtool_extra_stat_counter(int fd, const char *name, uint32_t id, return -1; if (id >= n_stats) { - ODP_ERR("Invalid counter id\n"); + _ODP_ERR("Invalid counter id\n"); ret = -1; } else { *stat = estats->data[id]; diff --git a/platform/linux-generic/pktio/stats/packet_io_stats.c b/platform/linux-generic/pktio/stats/packet_io_stats.c index 54df874f0..ac61c0343 100644 --- a/platform/linux-generic/pktio/stats/packet_io_stats.c +++ b/platform/linux-generic/pktio/stats/packet_io_stats.c @@ -24,7 +24,7 @@ static int sock_stats_get(pktio_entry_t *e, odp_pktio_stats_t *stats, int fd) ret = _odp_sysfs_stats(e, stats); if (ret) - ODP_ERR("Failed to get pktio statistics.\n"); + _ODP_ERR("Failed to get pktio statistics.\n"); return ret; } diff --git a/platform/linux-generic/pktio/stats/sysfs_stats.c b/platform/linux-generic/pktio/stats/sysfs_stats.c index 94872dfd7..d9fb0754c 100644 --- a/platform/linux-generic/pktio/stats/sysfs_stats.c +++ b/platform/linux-generic/pktio/stats/sysfs_stats.c @@ -32,7 +32,7 @@ static int sysfs_get_val(const char *fname, uint64_t *val) * kernel driver. */ if (errno != ENOENT) - ODP_ERR("fopen %s: %s\n", fname, strerror(errno)); + _ODP_ERR("fopen %s: %s\n", fname, strerror(errno)); return 0; } @@ -42,7 +42,7 @@ static int sysfs_get_val(const char *fname, uint64_t *val) (void)fclose(file); if (ret != 1) { - ODP_ERR("read %s\n", fname); + _ODP_ERR("read %s\n", fname); return -1; } @@ -103,7 +103,7 @@ int _odp_sysfs_extra_stat_info(pktio_entry_t *pktio_entry, snprintf(sysfs_dir, PATH_MAX, SYSFS_DIR, pktio_entry->name); dir = opendir(sysfs_dir); if (!dir) { - ODP_ERR("Failed to open sysfs dir: %s\n", sysfs_dir); + _ODP_ERR("Failed to open sysfs dir: %s\n", sysfs_dir); return -1; } @@ -135,7 +135,7 @@ int _odp_sysfs_extra_stats(pktio_entry_t *pktio_entry, uint64_t stats[], snprintf(sysfs_dir, PATH_MAX, SYSFS_DIR, pktio_entry->name); dir = opendir(sysfs_dir); if (!dir) { - ODP_ERR("Failed to open dir: %s\n", sysfs_dir); + _ODP_ERR("Failed to open dir: %s\n", sysfs_dir); return -1; } @@ -148,7 +148,7 @@ int _odp_sysfs_extra_stats(pktio_entry_t *pktio_entry, uint64_t stats[], snprintf(file_path, PATH_MAX, "%s/%s", sysfs_dir, e->d_name); if (sysfs_get_val(file_path, &val)) { - ODP_ERR("Failed to read file: %s/n", file_path); + _ODP_ERR("Failed to read file: %s/n", file_path); counters = -1; break; } @@ -176,7 +176,7 @@ int _odp_sysfs_extra_stat_counter(pktio_entry_t *pktio_entry, uint32_t id, snprintf(sysfs_dir, PATH_MAX, SYSFS_DIR, pktio_entry->name); dir = opendir(sysfs_dir); if (!dir) { - ODP_ERR("Failed to open dir: %s\n", sysfs_dir); + _ODP_ERR("Failed to open dir: %s\n", sysfs_dir); return -1; } @@ -191,7 +191,7 @@ int _odp_sysfs_extra_stat_counter(pktio_entry_t *pktio_entry, uint32_t id, snprintf(file_path, PATH_MAX, "%s/%s", sysfs_dir, e->d_name); if (sysfs_get_val(file_path, &val)) { - ODP_ERR("Failed to read file: %s/n", file_path); + _ODP_ERR("Failed to read file: %s/n", file_path); } else { *stat = val; ret = 0; diff --git a/platform/linux-generic/pktio/tap.c b/platform/linux-generic/pktio/tap.c index 7b0df4cac..604e53170 100644 --- a/platform/linux-generic/pktio/tap.c +++ b/platform/linux-generic/pktio/tap.c @@ -78,7 +78,7 @@ static int gen_random_mac(unsigned char *mac) { mac[0] = 0x7a; /* not multicast and local assignment bit is set */ if (odp_random_data(mac + 1, 5, ODP_RANDOM_BASIC) < 5) { - ODP_ERR("odp_random_data failed.\n"); + _ODP_ERR("odp_random_data failed.\n"); return -1; } return 0; @@ -99,8 +99,7 @@ static int mac_addr_set_fd(int fd, const char *name, ret = ioctl(fd, SIOCSIFHWADDR, ðreq); if (ret != 0) { _odp_errno = errno; - ODP_ERR("ioctl(SIOCSIFHWADDR): %s: \"%s\".\n", strerror(errno), - ethreq.ifr_name); + _ODP_ERR("ioctl(SIOCSIFHWADDR): %s: \"%s\".\n", strerror(errno), ethreq.ifr_name); return -1; } @@ -130,7 +129,7 @@ static int tap_pktio_open(odp_pktio_t id ODP_UNUSED, fd = open("/dev/net/tun", O_RDWR); if (fd < 0) { _odp_errno = errno; - ODP_ERR("failed to open /dev/net/tun: %s\n", strerror(errno)); + _ODP_ERR("failed to open /dev/net/tun: %s\n", strerror(errno)); return -1; } @@ -145,8 +144,7 @@ static int tap_pktio_open(odp_pktio_t id ODP_UNUSED, if (ioctl(fd, TUNSETIFF, (void *)&ifr) < 0) { _odp_errno = errno; - ODP_ERR("%s: creating tap device failed: %s\n", - ifr.ifr_name, strerror(errno)); + _ODP_ERR("%s: creating tap device failed: %s\n", ifr.ifr_name, strerror(errno)); goto tap_err; } @@ -154,13 +152,13 @@ static int tap_pktio_open(odp_pktio_t id ODP_UNUSED, flags = fcntl(fd, F_GETFL, 0); if (flags < 0) { _odp_errno = errno; - ODP_ERR("fcntl(F_GETFL) failed: %s\n", strerror(errno)); + _ODP_ERR("fcntl(F_GETFL) failed: %s\n", strerror(errno)); goto tap_err; } if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) { _odp_errno = errno; - ODP_ERR("fcntl(F_SETFL) failed: %s\n", strerror(errno)); + _ODP_ERR("fcntl(F_SETFL) failed: %s\n", strerror(errno)); goto tap_err; } @@ -171,14 +169,14 @@ static int tap_pktio_open(odp_pktio_t id ODP_UNUSED, skfd = socket(AF_INET, SOCK_DGRAM, 0); if (skfd < 0) { _odp_errno = errno; - ODP_ERR("socket creation failed: %s\n", strerror(errno)); + _ODP_ERR("socket creation failed: %s\n", strerror(errno)); goto tap_err; } mtu = _odp_mtu_get_fd(skfd, devname + 4); if (mtu == 0) { _odp_errno = errno; - ODP_ERR("_odp_mtu_get_fd failed: %s\n", strerror(errno)); + _ODP_ERR("_odp_mtu_get_fd failed: %s\n", strerror(errno)); goto sock_err; } tap->mtu_max = _ODP_SOCKET_MTU_MAX; @@ -194,7 +192,7 @@ sock_err: close(skfd); tap_err: close(fd); - ODP_ERR("Tap device alloc failed.\n"); + _ODP_ERR("Tap device alloc failed.\n"); return -1; } @@ -210,7 +208,7 @@ static int tap_pktio_start(pktio_entry_t *pktio_entry) /* Up interface by default. */ if (ioctl(tap->skfd, SIOCGIFFLAGS, &ifr) < 0) { _odp_errno = errno; - ODP_ERR("ioctl(SIOCGIFFLAGS) failed: %s\n", strerror(errno)); + _ODP_ERR("ioctl(SIOCGIFFLAGS) failed: %s\n", strerror(errno)); goto sock_err; } @@ -219,13 +217,13 @@ static int tap_pktio_start(pktio_entry_t *pktio_entry) if (ioctl(tap->skfd, SIOCSIFFLAGS, &ifr) < 0) { _odp_errno = errno; - ODP_ERR("failed to come up: %s\n", strerror(errno)); + _ODP_ERR("failed to come up: %s\n", strerror(errno)); goto sock_err; } return 0; sock_err: - ODP_ERR("Tap device open failed.\n"); + _ODP_ERR("Tap device open failed.\n"); return -1; } @@ -241,7 +239,7 @@ static int tap_pktio_stop(pktio_entry_t *pktio_entry) /* Up interface by default. */ if (ioctl(tap->skfd, SIOCGIFFLAGS, &ifr) < 0) { _odp_errno = errno; - ODP_ERR("ioctl(SIOCGIFFLAGS) failed: %s\n", strerror(errno)); + _ODP_ERR("ioctl(SIOCGIFFLAGS) failed: %s\n", strerror(errno)); goto sock_err; } @@ -250,13 +248,13 @@ static int tap_pktio_stop(pktio_entry_t *pktio_entry) if (ioctl(tap->skfd, SIOCSIFFLAGS, &ifr) < 0) { _odp_errno = errno; - ODP_ERR("failed to come up: %s\n", strerror(errno)); + _ODP_ERR("failed to come up: %s\n", strerror(errno)); goto sock_err; } return 0; sock_err: - ODP_ERR("Tap device open failed.\n"); + _ODP_ERR("Tap device open failed.\n"); return -1; } @@ -267,13 +265,13 @@ static int tap_pktio_close(pktio_entry_t *pktio_entry) if (tap->fd != -1 && close(tap->fd) != 0) { _odp_errno = errno; - ODP_ERR("close(tap->fd): %s\n", strerror(errno)); + _ODP_ERR("close(tap->fd): %s\n", strerror(errno)); ret = -1; } if (tap->skfd != -1 && close(tap->skfd) != 0) { _odp_errno = errno; - ODP_ERR("close(tap->skfd): %s\n", strerror(errno)); + _ODP_ERR("close(tap->skfd): %s\n", strerror(errno)); ret = -1; } @@ -301,7 +299,7 @@ static odp_packet_t pack_odp_pkt(pktio_entry_t *pktio_entry, const void *data, pull_head(pkt_hdr, frame_offset); if (odp_packet_copy_from_mem(pkt, 0, len, data) < 0) { - ODP_ERR("failed to copy packet data\n"); + _ODP_ERR("failed to copy packet data\n"); odp_packet_free(pkt); return ODP_PACKET_INVALID; } @@ -401,7 +399,7 @@ static int tap_pktio_send_lockless(pktio_entry_t *pktio_entry, } if (odp_packet_copy_to_mem(pkts[i], 0, pkt_len, buf) < 0) { - ODP_ERR("failed to copy packet data\n"); + _ODP_ERR("failed to copy packet data\n"); break; } @@ -412,12 +410,12 @@ static int tap_pktio_send_lockless(pktio_entry_t *pktio_entry, if (retval < 0) { if (i == 0 && SOCK_ERR_REPORT(errno)) { _odp_errno = errno; - ODP_ERR("write(): %s\n", strerror(errno)); + _ODP_ERR("write(): %s\n", strerror(errno)); return -1; } break; } else if ((uint32_t)retval != pkt_len) { - ODP_ERR("sent partial ethernet packet\n"); + _ODP_ERR("sent partial ethernet packet\n"); if (i == 0) { _odp_errno = EMSGSIZE; return -1; |