aboutsummaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2022-03-25 15:03:52 +0200
committerMatias Elo <matias.elo@nokia.com>2022-05-02 12:06:11 +0300
commit82d0da39fb22300cdfe5432a593d438b2e44b89d (patch)
treef9c14a30143e43760a78ed9ddb368e76f9d6b564 /platform
parent52cfc352aa497952470a2e0d1ae8d31c38d3c861 (diff)
linux-gen: macros: prefix implementation internal macro names
Add _ODP_ prefixes to implementation internal helper macros and collect common macros into a single header file (odp_macros_internal.h). Unused macros (DIV_ROUND_UP, odp_container_of) have been removed. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Diffstat (limited to 'platform')
-rw-r--r--platform/linux-generic/Makefile.am1
-rw-r--r--platform/linux-generic/include/odp_align_internal.h67
-rw-r--r--platform/linux-generic/include/odp_buffer_internal.h1
-rw-r--r--platform/linux-generic/include/odp_classification_datamodel.h9
-rw-r--r--platform/linux-generic/include/odp_macros_internal.h63
-rw-r--r--platform/linux-generic/include/odp_packet_io_internal.h4
-rw-r--r--platform/linux-generic/include/odp_parse_internal.h4
-rw-r--r--platform/linux-generic/include/odp_queue_basic_internal.h4
-rw-r--r--platform/linux-generic/include/odp_queue_scalable_internal.h6
-rw-r--r--platform/linux-generic/include/odp_ring_internal.h4
-rw-r--r--platform/linux-generic/include/odp_ring_mpmc_internal.h3
-rw-r--r--platform/linux-generic/include/odp_ring_st_internal.h2
-rw-r--r--platform/linux-generic/include/odp_schedule_scalable_ordered.h5
-rw-r--r--platform/linux-generic/odp_crypto_openssl.c3
-rw-r--r--platform/linux-generic/odp_ipsec.c7
-rw-r--r--platform/linux-generic/odp_ipsec_sad.c9
-rw-r--r--platform/linux-generic/odp_ishm.c1
-rw-r--r--platform/linux-generic/odp_ishmphy.c1
-rw-r--r--platform/linux-generic/odp_ishmpool.c13
-rw-r--r--platform/linux-generic/odp_name_table.c12
-rw-r--r--platform/linux-generic/odp_packet.c4
-rw-r--r--platform/linux-generic/odp_pcapng.c19
-rw-r--r--platform/linux-generic/odp_pkt_queue.c6
-rw-r--r--platform/linux-generic/odp_pool.c27
-rw-r--r--platform/linux-generic/odp_queue_basic.c7
-rw-r--r--platform/linux-generic/odp_queue_scalable.c10
-rw-r--r--platform/linux-generic/odp_schedule_basic.c10
-rw-r--r--platform/linux-generic/odp_schedule_scalable.c4
-rw-r--r--platform/linux-generic/odp_schedule_sp.c8
-rw-r--r--platform/linux-generic/odp_stash.c11
-rw-r--r--platform/linux-generic/odp_timer.c8
-rw-r--r--platform/linux-generic/odp_timer_wheel.c2
-rw-r--r--platform/linux-generic/odp_traffic_mngr.c46
-rw-r--r--platform/linux-generic/pktio/dpdk.c4
-rw-r--r--platform/linux-generic/pktio/ipc.c12
-rw-r--r--platform/linux-generic/pktio/loop.c2
-rw-r--r--platform/linux-generic/pktio/netmap.c12
-rw-r--r--platform/linux-generic/pktio/socket.c2
-rw-r--r--platform/linux-generic/pktio/socket_mmap.c4
39 files changed, 194 insertions, 223 deletions
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
index d4e94f677..49565502f 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -105,7 +105,6 @@ odpapiabiarchinclude_HEADERS += \
endif
noinst_HEADERS = \
- include/odp_align_internal.h \
include/odp_atomic_internal.h \
include/odp_bitset.h \
include/odp_buffer_internal.h \
diff --git a/platform/linux-generic/include/odp_align_internal.h b/platform/linux-generic/include/odp_align_internal.h
deleted file mode 100644
index df2182df2..000000000
--- a/platform/linux-generic/include/odp_align_internal.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Copyright (c) 2014-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-/**
- * @file
- *
- * ODP internal alignments
- */
-
-#ifndef ODP_ALIGN_INTERNAL_H_
-#define ODP_ALIGN_INTERNAL_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <odp/api/align.h>
-#include <stdint.h>
-
-/* Macros to calculate ODP_ROUNDUP_POWER2_U32() in five rounds of shift
- * and OR operations. */
-#define _RSHIFT_U32(x, y) (((uint32_t)(x)) >> (y))
-#define _POW2_U32_R1(x) (((uint32_t)(x)) | _RSHIFT_U32(x, 1))
-#define _POW2_U32_R2(x) (_POW2_U32_R1(x) | _RSHIFT_U32(_POW2_U32_R1(x), 2))
-#define _POW2_U32_R3(x) (_POW2_U32_R2(x) | _RSHIFT_U32(_POW2_U32_R2(x), 4))
-#define _POW2_U32_R4(x) (_POW2_U32_R3(x) | _RSHIFT_U32(_POW2_U32_R3(x), 8))
-#define _POW2_U32_R5(x) (_POW2_U32_R4(x) | _RSHIFT_U32(_POW2_U32_R4(x), 16))
-
-/* Round up a uint32_t value 'x' to the next power of two.
- *
- * The value is not round up, if it's already a power of two (including 1).
- * The value must be larger than 0 and not exceed 0x80000000.
- */
-#define ROUNDUP_POWER2_U32(x) \
- ((((uint32_t)(x)) > 0x80000000) ? 0 : (_POW2_U32_R5(x - 1) + 1))
-
-/*
- * Round up 'x' to alignment 'align'
- */
-#define ROUNDUP_ALIGN(x, align)\
- ((align) * (((x) + (align) - 1) / (align)))
-
-/*
- * Round up 'x' to cache line size alignment
- */
-#define ROUNDUP_CACHE_LINE(x)\
- ROUNDUP_ALIGN(x, ODP_CACHE_LINE_SIZE)
-
-/*
- * Round down 'x' to 'align' alignment, which is a power of two
- */
-#define ROUNDDOWN_POWER2(x, align)\
- ((x) & (~((align) - 1)))
-
-/*
- * Check if value is a power of two
- */
-#define CHECK_IS_POWER2(x) ((((x) - 1) & (x)) == 0)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h
index e0be593d0..5841720ef 100644
--- a/platform/linux-generic/include/odp_buffer_internal.h
+++ b/platform/linux-generic/include/odp_buffer_internal.h
@@ -24,7 +24,6 @@ extern "C" {
#include <odp/api/buffer.h>
#include <odp/api/debug.h>
#include <odp/api/align.h>
-#include <odp_align_internal.h>
#include <odp_config_internal.h>
#include <odp/api/byteorder.h>
#include <odp/api/thread.h>
diff --git a/platform/linux-generic/include/odp_classification_datamodel.h b/platform/linux-generic/include/odp_classification_datamodel.h
index 6b50fef68..6e89a9947 100644
--- a/platform/linux-generic/include/odp_classification_datamodel.h
+++ b/platform/linux-generic/include/odp_classification_datamodel.h
@@ -21,10 +21,13 @@ extern "C" {
#include <odp/api/spinlock.h>
#include <odp/api/classification.h>
#include <odp/api/debug.h>
+
+#include <odp_macros_internal.h>
#include <odp_pool_internal.h>
#include <odp_packet_internal.h>
#include <odp_packet_io_internal.h>
#include <odp_queue_if.h>
+
#include <protocols/ip.h>
/* Maximum Class Of Service Entry */
@@ -155,7 +158,7 @@ struct cos_s {
typedef union cos_u {
struct cos_s s;
- uint8_t pad[ROUNDUP_CACHE_LINE(sizeof(struct cos_s))];
+ uint8_t pad[_ODP_ROUNDUP_CACHE_LINE(sizeof(struct cos_s))];
} cos_t;
/* Pattern Matching Rule */
@@ -172,7 +175,7 @@ struct pmr_s {
typedef union pmr_u {
struct pmr_s s;
- uint8_t pad[ROUNDUP_CACHE_LINE(sizeof(struct pmr_s))];
+ uint8_t pad[_ODP_ROUNDUP_CACHE_LINE(sizeof(struct pmr_s))];
} pmr_t;
typedef struct _cls_queue_grp_tbl_s {
@@ -181,7 +184,7 @@ typedef struct _cls_queue_grp_tbl_s {
typedef union _cls_queue_grp_tbl_t {
_cls_queue_grp_tbl_s s;
- uint8_t pad[ROUNDUP_CACHE_LINE(sizeof(_cls_queue_grp_tbl_s))];
+ uint8_t pad[_ODP_ROUNDUP_CACHE_LINE(sizeof(_cls_queue_grp_tbl_s))];
} _cls_queue_grp_tbl_t;
/**
diff --git a/platform/linux-generic/include/odp_macros_internal.h b/platform/linux-generic/include/odp_macros_internal.h
index b8be7f938..abf017aec 100644
--- a/platform/linux-generic/include/odp_macros_internal.h
+++ b/platform/linux-generic/include/odp_macros_internal.h
@@ -1,4 +1,5 @@
-/* Copyright (c) 2018-2018, Linaro Limited
+/* Copyright (c) 2014-2018, Linaro Limited
+ * Copyright (c) 2022, Nokia
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -17,37 +18,67 @@
extern "C" {
#endif
-#include <odp/api/debug.h>
+#include <odp/api/align.h>
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#include <stdint.h>
-#define MIN(a, b) \
+#define _ODP_ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+#define _ODP_MIN(a, b) \
__extension__ ({ \
__typeof__(a) tmp_a = (a); \
__typeof__(b) tmp_b = (b); \
tmp_a < tmp_b ? tmp_a : tmp_b; \
})
-#define MAX(a, b) \
+#define _ODP_MAX(a, b) \
__extension__ ({ \
__typeof__(a) tmp_a = (a); \
__typeof__(b) tmp_b = (b); \
tmp_a > tmp_b ? tmp_a : tmp_b; \
})
-#define MAX3(a, b, c) (MAX(MAX((a), (b)), (c)))
+#define _ODP_MAX3(a, b, c) (_ODP_MAX(_ODP_MAX((a), (b)), (c)))
-#define odp_container_of(pointer, type, member) \
- ((type *)(void *)(((char *)pointer) - offsetof(type, member)))
+/* Macros to calculate ODP_ROUNDUP_POWER2_U32() in five rounds of shift
+ * and OR operations. */
+#define __ODP_RSHIFT_U32(x, y) (((uint32_t)(x)) >> (y))
+#define __ODP_POW2_U32_R1(x) (((uint32_t)(x)) | __ODP_RSHIFT_U32(x, 1))
+#define __ODP_POW2_U32_R2(x) (__ODP_POW2_U32_R1(x) | __ODP_RSHIFT_U32(__ODP_POW2_U32_R1(x), 2))
+#define __ODP_POW2_U32_R3(x) (__ODP_POW2_U32_R2(x) | __ODP_RSHIFT_U32(__ODP_POW2_U32_R2(x), 4))
+#define __ODP_POW2_U32_R4(x) (__ODP_POW2_U32_R3(x) | __ODP_RSHIFT_U32(__ODP_POW2_U32_R3(x), 8))
+#define __ODP_POW2_U32_R5(x) (__ODP_POW2_U32_R4(x) | __ODP_RSHIFT_U32(__ODP_POW2_U32_R4(x), 16))
-#define DIV_ROUND_UP(a, b) \
- __extension__ ({ \
- __typeof__(a) tmp_a = (a); \
- __typeof__(b) tmp_b = (b); \
- ODP_STATIC_ASSERT(__builtin_constant_p(b), ""); \
- ODP_STATIC_ASSERT((((b) - 1) & (b)) == 0, ""); \
- (tmp_a + tmp_b - 1) >> __builtin_ctz(tmp_b); \
- })
+/* Round up a uint32_t value 'x' to the next power of two.
+ *
+ * The value is not round up, if it's already a power of two (including 1).
+ * The value must be larger than 0 and not exceed 0x80000000.
+ */
+#define _ODP_ROUNDUP_POWER2_U32(x) \
+ ((((uint32_t)(x)) > 0x80000000) ? 0 : (__ODP_POW2_U32_R5(x - 1) + 1))
+
+/*
+ * Round up 'x' to alignment 'align'
+ */
+#define _ODP_ROUNDUP_ALIGN(x, align)\
+ ((align) * (((x) + (align) - 1) / (align)))
+
+/*
+ * Round up 'x' to cache line size alignment
+ */
+#define _ODP_ROUNDUP_CACHE_LINE(x)\
+ _ODP_ROUNDUP_ALIGN(x, ODP_CACHE_LINE_SIZE)
+
+/*
+ * Round down 'x' to 'align' alignment, which is a power of two
+ */
+#define _ODP_ROUNDDOWN_POWER2(x, align)\
+ ((x) & (~((align) - 1)))
+
+/*
+ * Check if value is a power of two
+ */
+#define _ODP_CHECK_IS_POWER2(x) ((((x) - 1) & (x)) == 0)
#ifdef __cplusplus
}
diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h
index aed6de412..a8697c069 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -26,10 +26,10 @@ extern "C" {
#include <odp/api/plat/packet_io_inlines.h>
#include <odp/autoheader_internal.h>
-#include <odp_align_internal.h>
#include <odp_classification_datamodel.h>
#include <odp_config_internal.h>
#include <odp_debug_internal.h>
+#include <odp_macros_internal.h>
#include <odp_packet_io_stats_common.h>
#include <odp_queue_if.h>
@@ -173,7 +173,7 @@ struct pktio_entry {
typedef union {
struct pktio_entry s;
- uint8_t pad[ROUNDUP_CACHE_LINE(sizeof(struct pktio_entry))];
+ uint8_t pad[_ODP_ROUNDUP_CACHE_LINE(sizeof(struct pktio_entry))];
} pktio_entry_t;
typedef struct {
diff --git a/platform/linux-generic/include/odp_parse_internal.h b/platform/linux-generic/include/odp_parse_internal.h
index 8aa5e118b..22d8c2cf6 100644
--- a/platform/linux-generic/include/odp_parse_internal.h
+++ b/platform/linux-generic/include/odp_parse_internal.h
@@ -45,8 +45,8 @@ extern "C" {
#define PARSE_SCTP_BYTES (sizeof(_odp_sctphdr_t))
/* _odp_packet_parse_common_l3_l4() requires up to this many bytes. */
-#define PARSE_L3_L4_BYTES (MAX(PARSE_IPV4_BYTES, PARSE_IPV6_BYTES) + \
- MAX3(PARSE_TCP_BYTES, PARSE_UDP_BYTES, PARSE_SCTP_BYTES))
+#define PARSE_L3_L4_BYTES (_ODP_MAX(PARSE_IPV4_BYTES, PARSE_IPV6_BYTES) + \
+ _ODP_MAX3(PARSE_TCP_BYTES, PARSE_UDP_BYTES, PARSE_SCTP_BYTES))
/* _odp_packet_parse_common() requires up to this many bytes. */
#define PARSE_BYTES (PARSE_ETH_BYTES + PARSE_L3_L4_BYTES)
diff --git a/platform/linux-generic/include/odp_queue_basic_internal.h b/platform/linux-generic/include/odp_queue_basic_internal.h
index d8a3226cb..9babb62e9 100644
--- a/platform/linux-generic/include/odp_queue_basic_internal.h
+++ b/platform/linux-generic/include/odp_queue_basic_internal.h
@@ -17,12 +17,12 @@ extern "C" {
#include <odp_forward_typedefs_internal.h>
#include <odp_queue_if.h>
#include <odp_buffer_internal.h>
-#include <odp_align_internal.h>
#include <odp/api/packet_io.h>
#include <odp/api/align.h>
#include <odp/api/hints.h>
#include <odp/api/ticketlock.h>
#include <odp_config_internal.h>
+#include <odp_macros_internal.h>
#include <odp_ring_mpmc_internal.h>
#include <odp_ring_st_internal.h>
#include <odp_ring_spsc_internal.h>
@@ -69,7 +69,7 @@ struct queue_entry_s {
union queue_entry_u {
struct queue_entry_s s;
- uint8_t pad[ROUNDUP_CACHE_LINE(sizeof(struct queue_entry_s))];
+ uint8_t pad[_ODP_ROUNDUP_CACHE_LINE(sizeof(struct queue_entry_s))];
};
typedef struct queue_global_t {
diff --git a/platform/linux-generic/include/odp_queue_scalable_internal.h b/platform/linux-generic/include/odp_queue_scalable_internal.h
index 6f9b85c85..3c74d1699 100644
--- a/platform/linux-generic/include/odp_queue_scalable_internal.h
+++ b/platform/linux-generic/include/odp_queue_scalable_internal.h
@@ -18,12 +18,12 @@ extern "C" {
#include <odp_forward_typedefs_internal.h>
#include <odp_queue_if.h>
#include <odp_event_internal.h>
-#include <odp_align_internal.h>
#include <odp/api/packet_io.h>
#include <odp/api/align.h>
#include <odp/api/hints.h>
#include <odp/api/ticketlock.h>
#include <odp_config_internal.h>
+#include <odp_macros_internal.h>
#include <odp_schedule_scalable.h>
#include <odp_schedule_scalable_ordered.h>
@@ -55,7 +55,7 @@ struct queue_entry_s {
union queue_entry_u {
struct queue_entry_s s;
- uint8_t pad[ROUNDUP_CACHE_LINE(sizeof(struct queue_entry_s))];
+ uint8_t pad[_ODP_ROUNDUP_CACHE_LINE(sizeof(struct queue_entry_s))];
};
int _odp_queue_deq(sched_elem_t *q, _odp_event_hdr_t *event_hdr[], int num);
@@ -71,7 +71,7 @@ static inline void *shm_pool_alloc_align(_odp_ishm_pool_t *pool, uint32_t size)
{
void *addr;
- addr = _odp_ishm_pool_alloc(pool, ROUNDUP_CACHE_LINE(size));
+ addr = _odp_ishm_pool_alloc(pool, _ODP_ROUNDUP_CACHE_LINE(size));
ODP_ASSERT(((uintptr_t)addr & (ODP_CACHE_LINE_SIZE - 1)) == 0);
return addr;
diff --git a/platform/linux-generic/include/odp_ring_internal.h b/platform/linux-generic/include/odp_ring_internal.h
index d11e81bf2..961e83448 100644
--- a/platform/linux-generic/include/odp_ring_internal.h
+++ b/platform/linux-generic/include/odp_ring_internal.h
@@ -15,12 +15,14 @@
extern "C" {
#endif
+#include <odp/api/align.h>
#include <odp/api/atomic.h>
#include <odp/api/cpu.h>
#include <odp/api/hints.h>
-#include <odp_align_internal.h>
+
#include <odp/api/plat/atomic_inlines.h>
#include <odp/api/plat/cpu_inlines.h>
+
#include <odp_ring_common.h>
/* Generic ring implementation
diff --git a/platform/linux-generic/include/odp_ring_mpmc_internal.h b/platform/linux-generic/include/odp_ring_mpmc_internal.h
index 473e69e90..6ed4dd4d1 100644
--- a/platform/linux-generic/include/odp_ring_mpmc_internal.h
+++ b/platform/linux-generic/include/odp_ring_mpmc_internal.h
@@ -11,10 +11,11 @@
extern "C" {
#endif
+#include <odp/api/align.h>
#include <odp/api/atomic.h>
#include <odp/api/cpu.h>
#include <odp/api/hints.h>
-#include <odp_align_internal.h>
+
#include <odp/api/plat/atomic_inlines.h>
#include <odp/api/plat/cpu_inlines.h>
diff --git a/platform/linux-generic/include/odp_ring_st_internal.h b/platform/linux-generic/include/odp_ring_st_internal.h
index 23b012d96..406d043b5 100644
--- a/platform/linux-generic/include/odp_ring_st_internal.h
+++ b/platform/linux-generic/include/odp_ring_st_internal.h
@@ -11,8 +11,8 @@
extern "C" {
#endif
+#include <odp/api/align.h>
#include <odp/api/hints.h>
-#include <odp_align_internal.h>
/* Basic ring for single thread usage. Operations must be synchronized by using
* locks (or other means), when multiple threads use the same ring. */
diff --git a/platform/linux-generic/include/odp_schedule_scalable_ordered.h b/platform/linux-generic/include/odp_schedule_scalable_ordered.h
index 21c89bed2..be4894f73 100644
--- a/platform/linux-generic/include/odp_schedule_scalable_ordered.h
+++ b/platform/linux-generic/include/odp_schedule_scalable_ordered.h
@@ -9,11 +9,12 @@
#ifndef ODP_SCHEDULE_SCALABLE_ORDERED_H
#define ODP_SCHEDULE_SCALABLE_ORDERED_H
+#include <odp/api/align.h>
#include <odp/api/shared_memory.h>
-#include <odp_align_internal.h>
#include <odp_bitset.h>
#include <odp_event_internal.h>
+#include <odp_macros_internal.h>
#include <odp_ishmpool_internal.h>
/* High level functioning of reordering
@@ -68,7 +69,7 @@ typedef struct ODP_ALIGNED(sizeof(uint64_t)) hc {
* Should be at least one per CPU.
*/
#define RWIN_SIZE 32
-ODP_STATIC_ASSERT(CHECK_IS_POWER2(RWIN_SIZE), "RWIN_SIZE is not a power of 2");
+ODP_STATIC_ASSERT(_ODP_CHECK_IS_POWER2(RWIN_SIZE), "RWIN_SIZE is not a power of 2");
typedef struct reorder_context reorder_context_t;
diff --git a/platform/linux-generic/odp_crypto_openssl.c b/platform/linux-generic/odp_crypto_openssl.c
index e5737e90c..9f0978b49 100644
--- a/platform/linux-generic/odp_crypto_openssl.c
+++ b/platform/linux-generic/odp_crypto_openssl.c
@@ -18,6 +18,7 @@
#include <odp/api/random.h>
#include <odp/api/plat/packet_inlines.h>
#include <odp/api/plat/thread_inlines.h>
+#include <odp_macros_internal.h>
#include <odp_packet_internal.h>
#include <odp/api/plat/queue_inlines.h>
#include <odp_global_data.h>
@@ -1013,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(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;
diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c
index 29f0e4bcd..04b4b6aeb 100644
--- a/platform/linux-generic/odp_ipsec.c
+++ b/platform/linux-generic/odp_ipsec.c
@@ -5,19 +5,20 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <odp/api/byteorder.h>
#include <odp/api/ipsec.h>
#include <odp/api/chksum.h>
#include <odp/api/plat/packet_inlines.h>
-#include <odp/api/byteorder.h>
#include <odp/api/plat/byteorder_inlines.h>
+#include <odp/api/plat/queue_inlines.h>
#include <odp_global_data.h>
#include <odp_init_internal.h>
#include <odp_debug_internal.h>
+#include <odp_macros_internal.h>
#include <odp_packet_internal.h>
#include <odp_ipsec_internal.h>
-#include <odp/api/plat/queue_inlines.h>
#include <odp_classification_internal.h>
#include <odp_libconfig_internal.h>
#include <odp_schedule_if.h>
@@ -1099,7 +1100,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(CHECK_IS_POWER2(pad_mask + 1));
+ ODP_ASSERT(_ODP_CHECK_IS_POWER2(pad_mask + 1));
return (len + pad_mask) & ~pad_mask;
}
diff --git a/platform/linux-generic/odp_ipsec_sad.c b/platform/linux-generic/odp_ipsec_sad.c
index 4e4057ede..64d7b6fdf 100644
--- a/platform/linux-generic/odp_ipsec_sad.c
+++ b/platform/linux-generic/odp_ipsec_sad.c
@@ -10,16 +10,17 @@
#include <odp/api/random.h>
#include <odp/api/shared_memory.h>
+#include <odp/api/plat/atomic_inlines.h>
+#include <odp/api/plat/cpu_inlines.h>
+
#include <odp_config_internal.h>
#include <odp_init_internal.h>
#include <odp_debug_internal.h>
#include <odp_ipsec_internal.h>
+#include <odp_macros_internal.h>
#include <odp_ring_mpmc_internal.h>
#include <odp_global_data.h>
-#include <odp/api/plat/atomic_inlines.h>
-#include <odp/api/plat/cpu_inlines.h>
-
#include <string.h>
#include <inttypes.h>
@@ -430,7 +431,7 @@ static uint32_t esp_block_len_to_mask(uint32_t block_len)
if (block_len < 4)
block_len = 4;
- ODP_ASSERT(CHECK_IS_POWER2(block_len));
+ ODP_ASSERT(_ODP_CHECK_IS_POWER2(block_len));
return block_len - 1;
}
diff --git a/platform/linux-generic/odp_ishm.c b/platform/linux-generic/odp_ishm.c
index dea4d56f0..0f7c48f35 100644
--- a/platform/linux-generic/odp_ishm.c
+++ b/platform/linux-generic/odp_ishm.c
@@ -45,7 +45,6 @@
#include <odp_errno_define.h>
#include <odp_shm_internal.h>
#include <odp_debug_internal.h>
-#include <odp_align_internal.h>
#include <odp_fdserver_internal.h>
#include <odp_shm_internal.h>
#include <odp_ishmphy_internal.h>
diff --git a/platform/linux-generic/odp_ishmphy.c b/platform/linux-generic/odp_ishmphy.c
index 64eb2a732..efaf12c7b 100644
--- a/platform/linux-generic/odp_ishmphy.c
+++ b/platform/linux-generic/odp_ishmphy.c
@@ -14,7 +14,6 @@
#include <odp/api/system_info.h>
#include <odp/api/debug.h>
#include <odp_debug_internal.h>
-#include <odp_align_internal.h>
#include <odp_shm_internal.h>
#include <odp_ishmphy_internal.h>
diff --git a/platform/linux-generic/odp_ishmpool.c b/platform/linux-generic/odp_ishmpool.c
index 818b0a132..4186444fa 100644
--- a/platform/linux-generic/odp_ishmpool.c
+++ b/platform/linux-generic/odp_ishmpool.c
@@ -43,14 +43,17 @@
*/
#include <odp_posix_extensions.h>
+
#include <odp/api/spinlock.h>
#include <odp/api/align.h>
#include <odp/api/debug.h>
+
#include <odp_shm_internal.h>
#include <odp_debug_internal.h>
-#include <odp_align_internal.h>
+#include <odp_macros_internal.h>
#include <odp_shm_internal.h>
#include <odp_ishmpool_internal.h>
+
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
@@ -203,14 +206,14 @@ static pool_t *_odp_ishmbud_pool_create(const char *pool_name, int store_idx,
max_nb_bblock = (1 << (order - min_order));
/* space needed for the control area (padded to cache line size)*/
- control_sz = ROUNDUP_CACHE_LINE(sizeof(_odp_ishm_pool_ctrl_t));
+ control_sz = _ODP_ROUNDUP_CACHE_LINE(sizeof(_odp_ishm_pool_ctrl_t));
/* space needed for 'order' free bblock list heads: */
/* Note that only lists from min_order to order are really used.*/
- free_head_sz = ROUNDUP_CACHE_LINE(sizeof(void *) * (order + 1));
+ free_head_sz = _ODP_ROUNDUP_CACHE_LINE(sizeof(void *) * (order + 1));
/* space needed for order -i.e. size- storage of alloc'd bblock:*/
- saved_order_sz = ROUNDUP_CACHE_LINE(max_nb_bblock * sizeof(uint8_t));
+ saved_order_sz = _ODP_ROUNDUP_CACHE_LINE(max_nb_bblock * sizeof(uint8_t));
/* space needed for user area is 2^order bytes: */
user_sz = 1ULL << order;
@@ -455,7 +458,7 @@ static pool_t *_odp_ishmslab_pool_create(const char *pool_name, int store_idx,
nb_sblock = (size / elt_size) + ((size % elt_size) ? 1 : 0);
/* space needed for the control area (padded to cache line size)*/
- control_sz = ROUNDUP_CACHE_LINE(sizeof(_odp_ishm_pool_ctrl_t));
+ control_sz = _ODP_ROUNDUP_CACHE_LINE(sizeof(_odp_ishm_pool_ctrl_t));
/* space needed for user area is : */
user_sz = nb_sblock * elt_size;
diff --git a/platform/linux-generic/odp_name_table.c b/platform/linux-generic/odp_name_table.c
index a9ce6cad3..fbb35cf00 100644
--- a/platform/linux-generic/odp_name_table.c
+++ b/platform/linux-generic/odp_name_table.c
@@ -248,7 +248,7 @@ static uint32_t name_tbl_free_list_add(name_tbl_t *name_tbl,
name_tbl_id = name_tbl->base_id | first_idx;
entry_idx = first_idx;
- num_added = MIN(num_to_add, name_tbl->num_avail_to_add);
+ num_added = _ODP_MIN(num_to_add, name_tbl->num_avail_to_add);
if (num_added == 0)
return 0;
@@ -299,7 +299,7 @@ static int new_name_tbl_add(void)
name_tbls_idx = name_tbls.num_name_tbls;
num_entries = INITIAL_NAME_TBL_SIZE << name_tbls_idx;
new_name_tbl = name_tbl_alloc(name_tbls_idx, num_entries);
- name_tbl_free_list_add(new_name_tbl, MIN(num_entries, UINT32_C(256)));
+ name_tbl_free_list_add(new_name_tbl, _ODP_MIN(num_entries, UINT32_C(256)));
name_tbls.tbls[name_tbls_idx] = new_name_tbl;
name_tbls.avail_space_bit_mask |= 1 << name_tbls_idx;
@@ -389,7 +389,7 @@ static hash_tbl_entry_t make_hash_tbl_entry(name_tbl_entry_t *name_tbl_entry,
hash_tbl_entry_t hash_tbl_entry;
uint32_t new_entry_cnt;
- new_entry_cnt = MIN(entry_cnt + 1, UINT32_C(0x3F));
+ new_entry_cnt = _ODP_MIN(entry_cnt + 1, UINT32_C(0x3F));
hash_tbl_entry = (hash_tbl_entry_t)(uintptr_t)name_tbl_entry;
hash_tbl_entry &= ~0x3F;
hash_tbl_entry |= new_entry_cnt;
@@ -1008,7 +1008,7 @@ static uint32_t level2_hash_histo(secondary_hash_tbl_t *hash_tbl,
collisions = linked_list_len(name_tbl_entry);
}
- level2_histo[MIN(collisions, UINT32_C(256))]++;
+ level2_histo[_ODP_MIN(collisions, UINT32_C(256))]++;
total_collisions += collisions;
}
@@ -1040,7 +1040,7 @@ static uint32_t level1_hash_histo(secondary_hash_tbl_t *hash_tbl,
level2_histo);
}
- level1_histo[MIN(collisions, UINT32_C(256))]++;
+ level1_histo[_ODP_MIN(collisions, UINT32_C(256))]++;
total_collisions += collisions;
}
@@ -1150,7 +1150,7 @@ void _odp_int_name_tbl_stats_print(void)
memset(primary_hash_histo, 0, sizeof(primary_hash_histo));
for (idx = 0; idx < PRIMARY_HASH_TBL_SIZE; idx++) {
collisions =
- MIN(name_hash_tbl.hash_collisions[idx], UINT32_C(256));
+ _ODP_MIN(name_hash_tbl.hash_collisions[idx], UINT32_C(256));
primary_hash_histo[collisions]++;
}
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c
index b0d0fc03c..07e9c2d4d 100644
--- a/platform/linux-generic/odp_packet.c
+++ b/platform/linux-generic/odp_packet.c
@@ -1241,7 +1241,7 @@ int odp_packet_align(odp_packet_t *pkt, uint32_t offset, uint32_t len,
if (seglen >= len) {
misalign = align <= 1 ? 0 :
- ROUNDUP_ALIGN(uaddr, align) - uaddr;
+ _ODP_ROUNDUP_ALIGN(uaddr, align) - uaddr;
if (misalign == 0)
return 0;
shift = align - misalign;
@@ -1251,7 +1251,7 @@ int odp_packet_align(odp_packet_t *pkt, uint32_t offset, uint32_t len,
shift = len - seglen;
uaddr -= shift;
misalign = align <= 1 ? 0 :
- ROUNDUP_ALIGN(uaddr, align) - uaddr;
+ _ODP_ROUNDUP_ALIGN(uaddr, align) - uaddr;
if (misalign)
shift += align - misalign;
}
diff --git a/platform/linux-generic/odp_pcapng.c b/platform/linux-generic/odp_pcapng.c
index 6bdd1fd69..2a4b7ad04 100644
--- a/platform/linux-generic/odp_pcapng.c
+++ b/platform/linux-generic/odp_pcapng.c
@@ -130,8 +130,7 @@ static void pcapng_drain_fifo(int fd)
static void inotify_event_handle(pktio_entry_t *entry, int qidx,
struct inotify_event *event)
{
- int mtu = MAX(odp_pktin_maxlen(entry->s.handle),
- odp_pktout_maxlen(entry->s.handle));
+ int mtu = _ODP_MAX(odp_pktin_maxlen(entry->s.handle), odp_pktout_maxlen(entry->s.handle));
if (event->mask & IN_OPEN) {
int ret;
@@ -173,8 +172,7 @@ static void get_pcapng_fifo_name(char *pcapng_entry, size_t len,
static int get_qidx_from_fifo(pktio_entry_t *entry, char *name)
{
- unsigned int max_queue =
- MAX(entry->s.num_in_queue, entry->s.num_out_queue);
+ unsigned int max_queue = _ODP_MAX(entry->s.num_in_queue, entry->s.num_out_queue);
unsigned int i;
for (i = 0; i < max_queue; i++) {
@@ -291,8 +289,7 @@ int _odp_pcapng_start(pktio_entry_t *entry)
int ret = -1, fd;
pthread_attr_t attr;
unsigned int i;
- unsigned int max_queue =
- MAX(entry->s.num_in_queue, entry->s.num_out_queue);
+ unsigned int max_queue = _ODP_MAX(entry->s.num_in_queue, entry->s.num_out_queue);
int fifo_sz;
fifo_sz = get_fifo_max_size();
@@ -396,8 +393,7 @@ void _odp_pcapng_stop(pktio_entry_t *entry)
{
int ret;
unsigned int i;
- unsigned int max_queue =
- MAX(entry->s.num_in_queue, entry->s.num_out_queue);
+ unsigned int max_queue = _ODP_MAX(entry->s.num_in_queue, entry->s.num_out_queue);
odp_spinlock_lock(&pcapng_gbl->lock);
@@ -528,7 +524,7 @@ int _odp_pcapng_write_pkts(pktio_entry_t *entry, int qidx,
NULL);
if (block_len + sizeof(epb[i]) +
- ROUNDUP_ALIGN(seg_len, PCAPNG_DATA_ALIGN) +
+ _ODP_ROUNDUP_ALIGN(seg_len, PCAPNG_DATA_ALIGN) +
sizeof(uint32_t) > PIPE_BUF) {
wlen = write_fifo(fd, packet_iov, iovcnt);
if (wlen > 0) {
@@ -539,7 +535,7 @@ int _odp_pcapng_write_pkts(pktio_entry_t *entry, int qidx,
}
epb[i].block_type = PCAPNG_BLOCK_TYPE_EPB;
epb[i].block_total_length = sizeof(epb[i]) +
- ROUNDUP_ALIGN(seg_len, PCAPNG_DATA_ALIGN) +
+ _ODP_ROUNDUP_ALIGN(seg_len, PCAPNG_DATA_ALIGN) +
PCAPNG_DATA_ALIGN;
epb[i].interface_idx = 0;
epb[i].timestamp_high =
@@ -556,8 +552,7 @@ int _odp_pcapng_write_pkts(pktio_entry_t *entry, int qidx,
/* data */
packet_iov[iovcnt].iov_base = buf;
- packet_iov[iovcnt].iov_len =
- ROUNDUP_ALIGN(seg_len, PCAPNG_DATA_ALIGN);
+ packet_iov[iovcnt].iov_len = _ODP_ROUNDUP_ALIGN(seg_len, PCAPNG_DATA_ALIGN);
block_len += packet_iov[iovcnt].iov_len;
iovcnt++;
diff --git a/platform/linux-generic/odp_pkt_queue.c b/platform/linux-generic/odp_pkt_queue.c
index 81ae334c1..e977efc24 100644
--- a/platform/linux-generic/odp_pkt_queue.c
+++ b/platform/linux-generic/odp_pkt_queue.c
@@ -125,7 +125,7 @@ static int pkt_queue_free_list_add(queue_pool_t *pool,
}
/* Now add as many queue_blks to the free list as... */
- blks_to_add = MIN(num_blks - start_idx, num_queue_blks);
+ blks_to_add = _ODP_MIN(num_blks - start_idx, num_queue_blks);
queue_blk = &queue_blks->blks[start_idx];
for (cnt = 1; cnt <= blks_to_add; cnt++) {
queue_blk->next_queue_blk_idx = start_idx + cnt;
@@ -223,7 +223,7 @@ _odp_int_queue_pool_t _odp_queue_pool_create(uint32_t max_num_queues,
/* Initialize the queue_blk_tbl_sizes array based upon the
* max_queued_pkts.
*/
- max_queued_pkts = MAX(max_queued_pkts, 64 * UINT32_C(1024));
+ max_queued_pkts = _ODP_MAX(max_queued_pkts, 64 * UINT32_C(1024));
queue_region_desc_init(pool, 0, max_queued_pkts / 4);
queue_region_desc_init(pool, 1, max_queued_pkts / 64);
queue_region_desc_init(pool, 2, max_queued_pkts / 64);
@@ -235,7 +235,7 @@ _odp_int_queue_pool_t _odp_queue_pool_create(uint32_t max_num_queues,
/* Now allocate the first queue_blk_tbl and add its blks to the free
* list. Replenish the queue_blk_t free list.
*/
- initial_free_list_size = MIN(64 * UINT32_C(1024), max_queued_pkts / 4);
+ initial_free_list_size = _ODP_MIN(64 * UINT32_C(1024), max_queued_pkts / 4);
rc = pkt_queue_free_list_add(pool, initial_free_list_size);
if (rc < 0) {
free(pool->queue_num_tbl);
diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c
index 8882a1174..48bd4a4df 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -18,6 +18,7 @@
#include <odp_packet_dpdk.h>
#include <odp_config_internal.h>
#include <odp_debug_internal.h>
+#include <odp_macros_internal.h>
#include <odp_ring_ptr_internal.h>
#include <odp_global_data.h>
#include <odp_libconfig_internal.h>
@@ -239,7 +240,7 @@ static int read_config_file(pool_global_t *pool_glb)
if (val == 0)
align = ODP_CACHE_LINE_SIZE;
- if (!CHECK_IS_POWER2(align)) {
+ if (!_ODP_CHECK_IS_POWER2(align)) {
ODP_ERR("Not a power of two: %s = %i\n", str, val);
return -1;
}
@@ -257,7 +258,7 @@ static int read_config_file(pool_global_t *pool_glb)
if (val == 0)
align = ODP_CACHE_LINE_SIZE;
- if (!CHECK_IS_POWER2(align)) {
+ if (!_ODP_CHECK_IS_POWER2(align)) {
ODP_ERR("Not a power of two: %s = %i\n", str, val);
return -1;
}
@@ -617,7 +618,7 @@ static int reserve_uarea(pool_t *pool, uint32_t uarea_size, uint32_t num_pkt, ui
sprintf(uarea_name, "pool_%03i_uarea_%s", pool->pool_idx, pool->name);
pool->param_uarea_size = uarea_size;
- pool->uarea_size = ROUNDUP_CACHE_LINE(uarea_size);
+ pool->uarea_size = _ODP_ROUNDUP_CACHE_LINE(uarea_size);
pool->uarea_shm_size = num_pkt * (uint64_t)pool->uarea_size;
shm = odp_shm_reserve(uarea_name, pool->uarea_shm_size, ODP_PAGE_SIZE, shmflags);
@@ -659,7 +660,7 @@ odp_pool_t _odp_pool_create(const char *name, const odp_pool_param_t *params,
uint32_t align_req = params->pkt.align;
if (align_req &&
- (!CHECK_IS_POWER2(align_req) ||
+ (!_ODP_CHECK_IS_POWER2(align_req) ||
align_req > _odp_pool_glb->config.pkt_base_align)) {
ODP_ERR("Bad align requirement\n");
return ODP_POOL_INVALID;
@@ -676,7 +677,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 != ROUNDDOWN_POWER2(align, align)) {
+ align != _ODP_ROUNDDOWN_POWER2(align, align)) {
ODP_ERR("Bad align requirement\n");
return ODP_POOL_INVALID;
}
@@ -777,7 +778,7 @@ odp_pool_t _odp_pool_create(const char *name, const odp_pool_param_t *params,
if (type == ODP_POOL_PACKET) {
uint32_t dpdk_obj_size;
- hdr_size = ROUNDUP_CACHE_LINE(sizeof(odp_packet_hdr_t));
+ hdr_size = _ODP_ROUNDUP_CACHE_LINE(sizeof(odp_packet_hdr_t));
block_size = hdr_size + align + headroom + seg_len + tailroom;
/* Calculate extra space required for storing DPDK objects and
* mbuf headers. NOP if no DPDK pktio used or zero-copy mode is
@@ -791,7 +792,7 @@ odp_pool_t _odp_pool_create(const char *name, const odp_pool_param_t *params,
shmflags |= ODP_SHM_HP;
block_size = dpdk_obj_size;
} else {
- block_size = ROUNDUP_CACHE_LINE(block_size);
+ block_size = _ODP_ROUNDUP_CACHE_LINE(block_size);
}
} else {
/* Header size is rounded up to cache line size, so the
@@ -801,13 +802,13 @@ odp_pool_t _odp_pool_create(const char *name, const odp_pool_param_t *params,
align - ODP_CACHE_LINE_SIZE : 0;
if (type == ODP_POOL_BUFFER)
- hdr_size = ROUNDUP_CACHE_LINE(sizeof(odp_buffer_hdr_t));
+ hdr_size = _ODP_ROUNDUP_CACHE_LINE(sizeof(odp_buffer_hdr_t));
else if (type == ODP_POOL_TIMEOUT)
- hdr_size = ROUNDUP_CACHE_LINE(sizeof(odp_timeout_hdr_t));
+ hdr_size = _ODP_ROUNDUP_CACHE_LINE(sizeof(odp_timeout_hdr_t));
else
- hdr_size = ROUNDUP_CACHE_LINE(sizeof(odp_event_vector_hdr_t));
+ hdr_size = _ODP_ROUNDUP_CACHE_LINE(sizeof(odp_event_vector_hdr_t));
- block_size = ROUNDUP_CACHE_LINE(hdr_size + align_pad + seg_len);
+ block_size = _ODP_ROUNDUP_CACHE_LINE(hdr_size + align_pad + seg_len);
}
/* Allocate extra memory for skipping packet buffers which cross huge
@@ -823,7 +824,7 @@ odp_pool_t _odp_pool_create(const char *name, const odp_pool_param_t *params,
if (num + 1 <= RING_SIZE_MIN)
ring_size = RING_SIZE_MIN;
else
- ring_size = ROUNDUP_POWER2_U32(num + 1);
+ ring_size = _ODP_ROUNDUP_POWER2_U32(num + 1);
pool->ring_mask = ring_size - 1;
pool->num = num;
@@ -1807,7 +1808,7 @@ odp_pool_t odp_pool_ext_create(const char *name, const odp_pool_ext_param_t *par
if (num_buf + 1 <= RING_SIZE_MIN)
ring_size = RING_SIZE_MIN;
else
- ring_size = ROUNDUP_POWER2_U32(num_buf + 1);
+ ring_size = _ODP_ROUNDUP_POWER2_U32(num_buf + 1);
pool->ring_mask = ring_size - 1;
pool->type = param->type;
diff --git a/platform/linux-generic/odp_queue_basic.c b/platform/linux-generic/odp_queue_basic.c
index 5155bae4b..9a1abfd3b 100644
--- a/platform/linux-generic/odp_queue_basic.c
+++ b/platform/linux-generic/odp_queue_basic.c
@@ -28,6 +28,7 @@
#include <odp_global_data.h>
#include <odp_queue_basic_internal.h>
#include <odp_event_internal.h>
+#include <odp_macros_internal.h>
#include <odp/api/plat/ticketlock_inlines.h>
#define LOCK(queue_ptr) odp_ticketlock_lock(&((queue_ptr)->s.lock))
@@ -77,7 +78,7 @@ static int read_config_file(queue_global_t *_odp_queue_glb)
val_u32 = val;
if (val_u32 > MAX_QUEUE_SIZE || val_u32 < MIN_QUEUE_SIZE ||
- !CHECK_IS_POWER2(val_u32)) {
+ !_ODP_CHECK_IS_POWER2(val_u32)) {
ODP_ERR("Bad value %s = %u\n", str, val_u32);
return -1;
}
@@ -95,7 +96,7 @@ 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 ||
- !CHECK_IS_POWER2(val_u32)) {
+ !_ODP_CHECK_IS_POWER2(val_u32)) {
ODP_ERR("Bad value %s = %u\n", str, val_u32);
return -1;
}
@@ -1039,7 +1040,7 @@ static int queue_init(queue_entry_t *queue, const char *name,
queue_size = MIN_QUEUE_SIZE;
/* Round up if not already a power of two */
- queue_size = ROUNDUP_POWER2_U32(queue_size);
+ 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);
diff --git a/platform/linux-generic/odp_queue_scalable.c b/platform/linux-generic/odp_queue_scalable.c
index c92ebeddd..881dbb985 100644
--- a/platform/linux-generic/odp_queue_scalable.c
+++ b/platform/linux-generic/odp_queue_scalable.c
@@ -104,7 +104,7 @@ static int queue_init(queue_entry_t *queue, const char *name,
sched_elem = &queue->s.sched_elem;
ring_size = param->size > 0 ?
- ROUNDUP_POWER2_U32(param->size) : CONFIG_SCAL_QUEUE_SIZE;
+ _ODP_ROUNDUP_POWER2_U32(param->size) : CONFIG_SCAL_QUEUE_SIZE;
strncpy(queue->s.name, name ? name : "", ODP_QUEUE_NAME_LEN - 1);
queue->s.name[ODP_QUEUE_NAME_LEN - 1] = 0;
memcpy(&queue->s.param, param, sizeof(odp_queue_param_t));
@@ -529,7 +529,7 @@ static inline int _odp_queue_enq(sched_elem_t *q,
*/
old_read = __atomic_load_n(&q->prod_read, __ATOMIC_ACQUIRE);
- actual = MIN(num, (int)((mask + 1) - (old_write - old_read)));
+ actual = _ODP_MIN(num, (int)((mask + 1) - (old_write - old_read)));
if (odp_unlikely(actual <= 0))
return 0;
@@ -591,7 +591,7 @@ int _odp_queue_enq_sp(sched_elem_t *q,
old_write = q->prod_write;
/* Consumer does store-release prod_read, we need load-acquire */
old_read = __atomic_load_n(&q->prod_read, __ATOMIC_ACQUIRE);
- actual = MIN(num, (int)((mask + 1) - (old_write - old_read)));
+ actual = _ODP_MIN(num, (int)((mask + 1) - (old_write - old_read)));
if (odp_unlikely(actual <= 0))
return 0;
@@ -704,7 +704,7 @@ int _odp_queue_deq_sc(sched_elem_t *q, odp_event_t *evp, int num)
old_read = q->cons_read;
/* Producer does store-release cons_write, we need load-acquire */
old_write = __atomic_load_n(&q->cons_write, __ATOMIC_ACQUIRE);
- actual = MIN(num, (int)(old_write - old_read));
+ actual = _ODP_MIN(num, (int)(old_write - old_read));
if (odp_unlikely(actual <= 0))
return 0;
@@ -757,7 +757,7 @@ int _odp_queue_deq(sched_elem_t *q, _odp_event_hdr_t *event_hdr[], int num)
/* Prefetch ring buffer array */
__builtin_prefetch(&q->cons_ring[old_read & mask], 0, 0);
- actual = MIN(num, (int)(old_write - old_read));
+ actual = _ODP_MIN(num, (int)(old_write - old_read));
if (odp_unlikely(actual <= 0))
return 0;
diff --git a/platform/linux-generic/odp_schedule_basic.c b/platform/linux-generic/odp_schedule_basic.c
index 3b22a5bb6..ad3de237f 100644
--- a/platform/linux-generic/odp_schedule_basic.c
+++ b/platform/linux-generic/odp_schedule_basic.c
@@ -27,7 +27,6 @@
#include <odp/api/cpu.h>
#include <odp/api/thrmask.h>
#include <odp_config_internal.h>
-#include <odp_align_internal.h>
#include <odp/api/sync.h>
#include <odp/api/packet_io.h>
#include <odp_ring_u32_internal.h>
@@ -37,6 +36,7 @@
#include <odp/api/plat/queue_inlines.h>
#include <odp_global_data.h>
#include <odp_event_internal.h>
+#include <odp_macros_internal.h>
#include <string.h>
@@ -94,11 +94,11 @@ ODP_STATIC_ASSERT((QUEUE_LOAD * CONFIG_MAX_SCHED_QUEUES) < UINT32_MAX, "Load_val
#define MAX_RING_SIZE CONFIG_MAX_SCHED_QUEUES
/* For best performance, the number of queues should be a power of two. */
-ODP_STATIC_ASSERT(CHECK_IS_POWER2(CONFIG_MAX_SCHED_QUEUES),
+ODP_STATIC_ASSERT(_ODP_CHECK_IS_POWER2(CONFIG_MAX_SCHED_QUEUES),
"Number_of_queues_is_not_power_of_two");
/* Ring size must be power of two, so that mask can be used. */
-ODP_STATIC_ASSERT(CHECK_IS_POWER2(MAX_RING_SIZE),
+ODP_STATIC_ASSERT(_ODP_CHECK_IS_POWER2(MAX_RING_SIZE),
"Ring_size_is_not_power_of_two");
/* Thread ID is saved into uint16_t variable */
@@ -289,7 +289,7 @@ ODP_STATIC_ASSERT(MAX_SPREAD <= 256, "Spread_does_not_fit_8_bits");
ODP_STATIC_ASSERT(CONFIG_QUEUE_MAX_ORD_LOCKS <= 256,
"Ordered_lock_count_does_not_fit_8_bits");
ODP_STATIC_ASSERT(NUM_PKTIO <= 256, "Pktio_index_does_not_fit_8_bits");
-ODP_STATIC_ASSERT(CHECK_IS_POWER2(GRP_WEIGHT_TBL_SIZE), "Not_power_of_2");
+ODP_STATIC_ASSERT(_ODP_CHECK_IS_POWER2(GRP_WEIGHT_TBL_SIZE), "Not_power_of_2");
/* Global scheduler context */
static sched_global_t *sched;
@@ -503,7 +503,7 @@ static int schedule_init_global(void)
num_rings = sched->config.num_spread;
}
- ring_size = ROUNDUP_POWER2_U32(ring_size);
+ ring_size = _ODP_ROUNDUP_POWER2_U32(ring_size);
ODP_ASSERT(ring_size <= MAX_RING_SIZE);
sched->ring_mask = ring_size - 1;
diff --git a/platform/linux-generic/odp_schedule_scalable.c b/platform/linux-generic/odp_schedule_scalable.c
index 7482d776d..4e071a78d 100644
--- a/platform/linux-generic/odp_schedule_scalable.c
+++ b/platform/linux-generic/odp_schedule_scalable.c
@@ -24,13 +24,13 @@
#include <odp_shm_internal.h>
#include <odp_ishmpool_internal.h>
-#include <odp_align_internal.h>
#include <odp/api/plat/cpu_inlines.h>
#include <odp_llqueue.h>
#include <odp_queue_scalable_internal.h>
#include <odp_schedule_if.h>
#include <odp_bitset.h>
#include <odp_event_internal.h>
+#include <odp_macros_internal.h>
#include <odp_packet_io_internal.h>
#include <odp_timer_internal.h>
@@ -46,7 +46,7 @@
#define FLAG_PKTIN 0x80
-ODP_STATIC_ASSERT(CHECK_IS_POWER2(CONFIG_MAX_SCHED_QUEUES),
+ODP_STATIC_ASSERT(_ODP_CHECK_IS_POWER2(CONFIG_MAX_SCHED_QUEUES),
"Number_of_queues_is_not_power_of_two");
#define SCHED_GROUP_JOIN 0
diff --git a/platform/linux-generic/odp_schedule_sp.c b/platform/linux-generic/odp_schedule_sp.c
index 558c3f4fe..9d805a53a 100644
--- a/platform/linux-generic/odp_schedule_sp.c
+++ b/platform/linux-generic/odp_schedule_sp.c
@@ -24,9 +24,9 @@
#include <odp_schedule_if.h>
#include <odp_debug_internal.h>
-#include <odp_align_internal.h>
#include <odp_config_internal.h>
#include <odp_event_internal.h>
+#include <odp_macros_internal.h>
#include <odp_ring_u32_internal.h>
#include <odp_timer_internal.h>
#include <odp_queue_basic_internal.h>
@@ -53,11 +53,11 @@
#define GROUP_PKTIN GROUP_ALL
/* Maximum number of commands: one priority/group for all queues and pktios */
-#define RING_SIZE (ROUNDUP_POWER2_U32(NUM_QUEUE + NUM_PKTIO))
+#define RING_SIZE (_ODP_ROUNDUP_POWER2_U32(NUM_QUEUE + NUM_PKTIO))
#define RING_MASK (RING_SIZE - 1)
/* Ring size must be power of two */
-ODP_STATIC_ASSERT(CHECK_IS_POWER2(RING_SIZE),
+ODP_STATIC_ASSERT(_ODP_CHECK_IS_POWER2(RING_SIZE),
"Ring_size_is_not_power_of_two");
ODP_STATIC_ASSERT(NUM_ORDERED_LOCKS <= CONFIG_QUEUE_MAX_ORD_LOCKS,
@@ -80,7 +80,7 @@ struct sched_cmd_s {
typedef struct ODP_ALIGNED_CACHE sched_cmd_t {
struct sched_cmd_s s;
- uint8_t pad[ROUNDUP_CACHE_LINE(sizeof(struct sched_cmd_s)) -
+ uint8_t pad[_ODP_ROUNDUP_CACHE_LINE(sizeof(struct sched_cmd_s)) -
sizeof(struct sched_cmd_s)];
} sched_cmd_t;
diff --git a/platform/linux-generic/odp_stash.c b/platform/linux-generic/odp_stash.c
index 9dbc8cc26..e12f1aed3 100644
--- a/platform/linux-generic/odp_stash.c
+++ b/platform/linux-generic/odp_stash.c
@@ -4,10 +4,6 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-
#include <odp/api/ticketlock.h>
#include <odp/api/shared_memory.h>
#include <odp/api/stash.h>
@@ -17,9 +13,14 @@
#include <odp_debug_internal.h>
#include <odp_global_data.h>
#include <odp_init_internal.h>
+#include <odp_macros_internal.h>
#include <odp_ring_u32_internal.h>
#include <odp_ring_u64_internal.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+
ODP_STATIC_ASSERT(CONFIG_INTERNAL_STASHES < CONFIG_MAX_STASHES, "TOO_MANY_INTERNAL_STASHES");
#define MAX_RING_SIZE (1024 * 1024)
@@ -203,7 +204,7 @@ odp_stash_t odp_stash_create(const char *name, const odp_stash_param_t *param)
if (ring_size + 1 <= MIN_RING_SIZE)
ring_size = MIN_RING_SIZE;
else
- ring_size = ROUNDUP_POWER2_U32(ring_size + 1);
+ ring_size = _ODP_ROUNDUP_POWER2_U32(ring_size + 1);
memset(shm_name, 0, sizeof(shm_name));
snprintf(shm_name, sizeof(shm_name) - 1, "_stash_%s", name);
diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c
index 1c54ab740..3af1ae737 100644
--- a/platform/linux-generic/odp_timer.c
+++ b/platform/linux-generic/odp_timer.c
@@ -37,7 +37,6 @@
#include <odp/api/plat/timer_inline_types.h>
-#include <odp_align_internal.h>
#include <odp_atomic_internal.h>
#include <odp_debug_internal.h>
#include <odp_errno_define.h>
@@ -45,6 +44,7 @@
#include <odp_global_data.h>
#include <odp_init_internal.h>
#include <odp_libconfig_internal.h>
+#include <odp_macros_internal.h>
#include <odp_pool_internal.h>
#include <odp_queue_if.h>
#include <odp_timer_internal.h>
@@ -431,9 +431,9 @@ static odp_timer_pool_t timer_pool_new(const char *name,
}
}
- sz0 = ROUNDUP_CACHE_LINE(sizeof(timer_pool_t));
- sz1 = ROUNDUP_CACHE_LINE(sizeof(tick_buf_t) * param->num_timers);
- sz2 = ROUNDUP_CACHE_LINE(sizeof(_odp_timer_t) * param->num_timers);
+ sz0 = _ODP_ROUNDUP_CACHE_LINE(sizeof(timer_pool_t));
+ sz1 = _ODP_ROUNDUP_CACHE_LINE(sizeof(tick_buf_t) * param->num_timers);
+ sz2 = _ODP_ROUNDUP_CACHE_LINE(sizeof(_odp_timer_t) * param->num_timers);
tp_size = sz0 + sz1 + sz2;
shm = odp_shm_reserve(name, tp_size, ODP_CACHE_LINE_SIZE, flags);
diff --git a/platform/linux-generic/odp_timer_wheel.c b/platform/linux-generic/odp_timer_wheel.c
index c50d3a13d..e597d5f70 100644
--- a/platform/linux-generic/odp_timer_wheel.c
+++ b/platform/linux-generic/odp_timer_wheel.c
@@ -632,7 +632,7 @@ static int timer_current_wheel_update(timer_wheels_t *timer_wheels,
slot_idx = wheel_desc->slot_idx;
num_slots = wheel_desc->num_slots;
max_ticks = wheel_desc->max_ticks;
- max_cnt = MIN(elapsed_ticks, UINT32_C(32));
+ max_cnt = _ODP_MIN(elapsed_ticks, UINT32_C(32));
current_wheel = timer_wheels->current_wheel;
ret_code = 0;
rc = -1;
diff --git a/platform/linux-generic/odp_traffic_mngr.c b/platform/linux-generic/odp_traffic_mngr.c
index 2572cd73e..9bea659e9 100644
--- a/platform/linux-generic/odp_traffic_mngr.c
+++ b/platform/linux-generic/odp_traffic_mngr.c
@@ -649,7 +649,7 @@ static void tm_shaper_params_cvt_to(const odp_tm_shaper_params_t *shaper_params,
} else {
max_peak_time_delta = tm_max_time_delta(peak_rate);
peak_burst = (int64_t)shaper_params->peak_burst;
- highest_rate = MAX(commit_rate, peak_rate);
+ highest_rate = _ODP_MAX(commit_rate, peak_rate);
min_time_delta = (uint32_t)((1 << 26) / highest_rate);
}
@@ -836,7 +836,7 @@ static void update_shaper_elapsed_time(tm_system_t *tm_system,
else
commit_inc = time_delta * shaper_params->commit_rate;
- shaper_obj->commit_cnt = (int64_t)MIN(max_commit, commit + commit_inc);
+ shaper_obj->commit_cnt = (int64_t)_ODP_MIN(max_commit, commit + commit_inc);
if (shaper_params->dual_rate) {
peak = shaper_obj->peak_cnt;
@@ -846,7 +846,7 @@ static void update_shaper_elapsed_time(tm_system_t *tm_system,
else
peak_inc = time_delta * shaper_params->peak_rate;
- shaper_obj->peak_cnt = (int64_t)MIN(max_peak, peak + peak_inc);
+ shaper_obj->peak_cnt = (int64_t)_ODP_MIN(max_peak, peak + peak_inc);
}
shaper_obj->last_update_time = tm_system->current_time;
@@ -866,9 +866,8 @@ static uint64_t time_till_not_red(tm_shaper_params_t *shaper_params,
commit_delay = (-shaper_obj->commit_cnt)
/ shaper_params->commit_rate;
- min_time_delay =
- MAX(shaper_obj->shaper_params->min_time_delta, UINT64_C(256));
- commit_delay = MAX(commit_delay, min_time_delay);
+ min_time_delay = _ODP_MAX(shaper_obj->shaper_params->min_time_delta, UINT64_C(256));
+ commit_delay = _ODP_MAX(commit_delay, min_time_delay);
if (!shaper_params->dual_rate)
return commit_delay;
@@ -876,13 +875,13 @@ static uint64_t time_till_not_red(tm_shaper_params_t *shaper_params,
if (shaper_obj->peak_cnt < 0)
peak_delay = (-shaper_obj->peak_cnt) / shaper_params->peak_rate;
- peak_delay = MAX(peak_delay, min_time_delay);
+ peak_delay = _ODP_MAX(peak_delay, min_time_delay);
if (0 < shaper_obj->commit_cnt)
return peak_delay;
else if (0 < shaper_obj->peak_cnt)
return commit_delay;
else
- return MIN(commit_delay, peak_delay);
+ return _ODP_MIN(commit_delay, peak_delay);
}
static int delete_timer(tm_system_t *tm_system ODP_UNUSED,
@@ -1192,8 +1191,8 @@ static int tm_set_finish_time(tm_schedulers_obj_t *schedulers_obj,
frame_weight = ((inverted_weight * frame_len) + (1 << 15)) >> 16;
sched_state = &schedulers_obj->sched_states[new_priority];
- base_virtual_time = MAX(prod_shaper_obj->virtual_finish_time,
- sched_state->base_virtual_time);
+ base_virtual_time = _ODP_MAX(prod_shaper_obj->virtual_finish_time,
+ sched_state->base_virtual_time);
virtual_finish_time = base_virtual_time + frame_weight;
prod_shaper_obj->virtual_finish_time = virtual_finish_time;
@@ -1805,7 +1804,7 @@ static odp_tm_percent_t tm_queue_fullness(tm_wred_params_t *wred_params,
return 0;
fullness = (10000 * current_cnt) / max_cnt;
- return (odp_tm_percent_t)MIN(fullness, UINT64_C(50000));
+ return (odp_tm_percent_t)_ODP_MIN(fullness, UINT64_C(50000));
}
static odp_bool_t tm_local_random_drop(tm_system_t *tm_system,
@@ -2711,11 +2710,10 @@ static void tm_system_capabilities_set(odp_tm_capabilities_t *cap_ptr,
uint32_t min_weight, max_weight;
uint8_t max_priority;
- num_levels = MAX(MIN(req_ptr->num_levels, ODP_TM_MAX_LEVELS), 1);
+ num_levels = _ODP_MAX(_ODP_MIN(req_ptr->num_levels, ODP_TM_MAX_LEVELS), 1);
memset(cap_ptr, 0, sizeof(odp_tm_capabilities_t));
- max_queues = MIN(req_ptr->max_tm_queues,
- (uint32_t)ODP_TM_MAX_NUM_TM_NODES);
+ max_queues = _ODP_MIN(req_ptr->max_tm_queues, (uint32_t)ODP_TM_MAX_NUM_TM_NODES);
shaper_supported = req_ptr->tm_queue_shaper_needed;
wred_supported = req_ptr->tm_queue_wred_needed;
dual_slope = req_ptr->tm_queue_dual_slope_needed;
@@ -2756,16 +2754,16 @@ static void tm_system_capabilities_set(odp_tm_capabilities_t *cap_ptr,
per_level_cap = &cap_ptr->per_level[level_idx];
per_level_req = &req_ptr->per_level[level_idx];
- max_nodes = MIN(per_level_req->max_num_tm_nodes,
- (uint32_t)ODP_TM_MAX_NUM_TM_NODES);
- max_fanin = MIN(per_level_req->max_fanin_per_node,
- UINT32_C(1024));
- max_priority = MIN(per_level_req->max_priority,
- ODP_TM_MAX_PRIORITIES - 1);
- min_weight = MAX(per_level_req->min_weight,
- ODP_TM_MIN_SCHED_WEIGHT);
- max_weight = MIN(per_level_req->max_weight,
- ODP_TM_MAX_SCHED_WEIGHT);
+ max_nodes = _ODP_MIN(per_level_req->max_num_tm_nodes,
+ (uint32_t)ODP_TM_MAX_NUM_TM_NODES);
+ max_fanin = _ODP_MIN(per_level_req->max_fanin_per_node,
+ UINT32_C(1024));
+ max_priority = _ODP_MIN(per_level_req->max_priority,
+ ODP_TM_MAX_PRIORITIES - 1);
+ min_weight = _ODP_MAX(per_level_req->min_weight,
+ ODP_TM_MIN_SCHED_WEIGHT);
+ max_weight = _ODP_MIN(per_level_req->max_weight,
+ ODP_TM_MAX_SCHED_WEIGHT);
shaper_supported = per_level_req->tm_node_shaper_needed;
wred_supported = per_level_req->tm_node_wred_needed;
dual_slope = per_level_req->tm_node_dual_slope_needed;
diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c
index 030560b0d..95aaf0f23 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -23,7 +23,6 @@
#include <odp/api/time.h>
#include <odp/api/plat/time_inlines.h>
-#include <odp_align_internal.h>
#include <odp_packet_io_internal.h>
#include <odp_classification_internal.h>
#include <odp_socket_common.h>
@@ -31,6 +30,7 @@
#include <odp_debug_internal.h>
#include <odp_libconfig_internal.h>
#include <odp_errno_define.h>
+#include <odp_macros_internal.h>
#include <protocols/eth.h>
#include <protocols/udp.h>
@@ -120,7 +120,7 @@ struct pkt_cache_t {
typedef union ODP_ALIGNED_CACHE {
struct pkt_cache_t s;
- uint8_t pad[ROUNDUP_CACHE_LINE(sizeof(struct pkt_cache_t))];
+ uint8_t pad[_ODP_ROUNDUP_CACHE_LINE(sizeof(struct pkt_cache_t))];
} pkt_cache_t;
/** Packet IO using DPDK interface */
diff --git a/platform/linux-generic/pktio/ipc.c b/platform/linux-generic/pktio/ipc.c
index 81938a983..455243159 100644
--- a/platform/linux-generic/pktio/ipc.c
+++ b/platform/linux-generic/pktio/ipc.c
@@ -5,10 +5,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <odp/api/system_info.h>
+
#include <odp_debug_internal.h>
#include <odp_packet_io_internal.h>
#include <odp_errno_define.h>
-#include <odp/api/system_info.h>
+#include <odp_macros_internal.h>
#include <odp_shm_internal.h>
#include <odp_ring_ptr_internal.h>
#include <odp_global_data.h>
@@ -124,7 +126,7 @@ static ring_ptr_t *_ring_create(const char *name, uint32_t count,
shm_flags |= ODP_SHM_SINGLE_VA;
/* count must be a power of 2 */
- if (!CHECK_IS_POWER2(count)) {
+ if (!_ODP_CHECK_IS_POWER2(count)) {
ODP_ERR("Requested size is invalid, must be a power of 2\n");
_odp_errno = EINVAL;
return NULL;
@@ -234,17 +236,17 @@ static int _ipc_init_master(pktio_entry_t *pktio_entry,
uint32_t ring_size;
uint32_t ring_mask;
- if ((uint64_t)ROUNDUP_POWER2_U32(pool->num + 1) > UINT32_MAX) {
+ if ((uint64_t)_ODP_ROUNDUP_POWER2_U32(pool->num + 1) > UINT32_MAX) {
ODP_ERR("Too large packet pool\n");
return -1;
}
/* Ring must be able to store all packets in the pool */
- ring_size = ROUNDUP_POWER2_U32(pool->num + 1);
+ ring_size = _ODP_ROUNDUP_POWER2_U32(pool->num + 1);
/* Ring size has to larger than burst size */
if (ring_size <= IPC_BURST_SIZE)
- ring_size = ROUNDUP_POWER2_U32(IPC_BURST_SIZE + 1);
+ ring_size = _ODP_ROUNDUP_POWER2_U32(IPC_BURST_SIZE + 1);
ring_mask = ring_size - 1;
pktio_ipc->ring_size = ring_size;
diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c
index 2441d8bcb..c702f9ded 100644
--- a/platform/linux-generic/pktio/loop.c
+++ b/platform/linux-generic/pktio/loop.c
@@ -197,7 +197,7 @@ static int loopback_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED,
* parser in the case of a segmented packet. */
if (odp_unlikely(seg_len < PARSE_BYTES &&
pkt_len > seg_len)) {
- seg_len = MIN(pkt_len, PARSE_BYTES);
+ seg_len = _ODP_MIN(pkt_len, PARSE_BYTES);
odp_packet_copy_to_mem(pkt, 0, seg_len, buf);
pkt_addr = buf;
} else {
diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c
index 94b88e21e..342f38431 100644
--- a/platform/linux-generic/pktio/netmap.c
+++ b/platform/linux-generic/pktio/netmap.c
@@ -24,17 +24,17 @@
#include <odp_socket_common.h>
#include <odp_debug_internal.h>
#include <odp_errno_define.h>
-#include <protocols/eth.h>
+#include <odp_classification_datamodel.h>
+#include <odp_classification_internal.h>
+#include <odp_libconfig_internal.h>
+#include <odp_macros_internal.h>
+#include <protocols/eth.h>
#include <sys/ioctl.h>
#include <sys/syscall.h>
#include <poll.h>
#include <linux/ethtool.h>
#include <linux/sockios.h>
-#include <odp_classification_datamodel.h>
-#include <odp_classification_internal.h>
-#include <odp_libconfig_internal.h>
-
#include <inttypes.h>
/* Disable netmap debug prints */
@@ -73,7 +73,7 @@ struct netmap_ring_t {
typedef union ODP_ALIGNED_CACHE {
struct netmap_ring_t s;
- uint8_t pad[ROUNDUP_CACHE_LINE(sizeof(struct netmap_ring_t))];
+ uint8_t pad[_ODP_ROUNDUP_CACHE_LINE(sizeof(struct netmap_ring_t))];
} netmap_ring_t;
/** Netmap ring slot */
diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c
index 9d1bbe545..0d756c4e1 100644
--- a/platform/linux-generic/pktio/socket.c
+++ b/platform/linux-generic/pktio/socket.c
@@ -289,7 +289,7 @@ static int sock_mmsg_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED,
/* Make sure there is enough data for the packet
* parser in the case of a segmented packet. */
if (odp_unlikely(seg_len < PARSE_BYTES && pkt_len > seg_len)) {
- seg_len = MIN(pkt_len, PARSE_BYTES);
+ seg_len = _ODP_MIN(pkt_len, PARSE_BYTES);
odp_packet_copy_to_mem(pkt, 0, seg_len, buf);
base = buf;
}
diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c
index 7824b0e91..4845b5dab 100644
--- a/platform/linux-generic/pktio/socket_mmap.c
+++ b/platform/linux-generic/pktio/socket_mmap.c
@@ -25,6 +25,7 @@
#include <odp_classification_datamodel.h>
#include <odp_classification_internal.h>
#include <odp_global_data.h>
+#include <odp_macros_internal.h>
#include <protocols/eth.h>
#include <protocols/ip.h>
@@ -433,8 +434,7 @@ static int mmap_setup_ring(pkt_sock_mmap_t *pkt_sock, struct ring *ring,
ring->type = type;
ring->version = TPACKET_V2;
- frame_size = ROUNDUP_POWER2_U32(mtu + TPACKET_HDRLEN
- + TPACKET_ALIGNMENT);
+ frame_size = _ODP_ROUNDUP_POWER2_U32(mtu + TPACKET_HDRLEN + TPACKET_ALIGNMENT);
block_size = BLOCK_SIZE;
if (frame_size > block_size)
block_size = frame_size;