aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/include
diff options
context:
space:
mode:
Diffstat (limited to 'platform/linux-generic/include')
-rw-r--r--platform/linux-generic/include/odp/api/plat/crypto_inlines.h8
-rw-r--r--platform/linux-generic/include/odp/api/plat/event_inlines.h16
-rw-r--r--platform/linux-generic/include/odp/api/plat/thread_inline_types.h2
-rw-r--r--platform/linux-generic/include/odp/api/plat/thread_inlines.h8
-rw-r--r--platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h5
-rw-r--r--platform/linux-generic/include/odp/api/plat/time_inlines.h16
-rw-r--r--platform/linux-generic/include/odp/api/plat/timer_inlines.h11
-rw-r--r--platform/linux-generic/include/odp_chksum_internal.h29
-rw-r--r--platform/linux-generic/include/odp_classification_datamodel.h36
-rw-r--r--platform/linux-generic/include/odp_config_internal.h22
-rw-r--r--platform/linux-generic/include/odp_event_internal.h2
-rw-r--r--platform/linux-generic/include/odp_packet_internal.h2
-rw-r--r--platform/linux-generic/include/odp_packet_io_internal.h6
-rw-r--r--platform/linux-generic/include/odp_pool_internal.h2
-rw-r--r--platform/linux-generic/include/odp_schedule_scalable.h8
15 files changed, 97 insertions, 76 deletions
diff --git a/platform/linux-generic/include/odp/api/plat/crypto_inlines.h b/platform/linux-generic/include/odp/api/plat/crypto_inlines.h
index ddf7debf4..f350edfea 100644
--- a/platform/linux-generic/include/odp/api/plat/crypto_inlines.h
+++ b/platform/linux-generic/include/odp/api/plat/crypto_inlines.h
@@ -55,14 +55,8 @@ _ODP_INLINE int odp_crypto_result(odp_crypto_packet_result_t *result, odp_packet
ok = op_result->cipher_status.alg_err == ODP_CRYPTO_ALG_ERR_NONE &&
op_result->auth_status.alg_err == ODP_CRYPTO_ALG_ERR_NONE;
- if (result) {
+ if (result)
*result = *op_result;
-#if ODP_DEPRECATED_API
- result->ok = ok;
- result->cipher_status.hw_err = ODP_CRYPTO_HW_ERR_NONE;
- result->auth_status.hw_err = ODP_CRYPTO_HW_ERR_NONE;
-#endif
- }
return ok ? 0 : -1;
}
diff --git a/platform/linux-generic/include/odp/api/plat/event_inlines.h b/platform/linux-generic/include/odp/api/plat/event_inlines.h
index 2e7c7db5e..b68ced244 100644
--- a/platform/linux-generic/include/odp/api/plat/event_inlines.h
+++ b/platform/linux-generic/include/odp/api/plat/event_inlines.h
@@ -11,6 +11,7 @@
#include <odp/api/buffer_types.h>
#include <odp/api/event_types.h>
#include <odp/api/packet_types.h>
+#include <odp/api/pool_types.h>
#include <odp/api/timer_types.h>
#include <odp/api/plat/buffer_inline_types.h>
@@ -27,6 +28,7 @@
#define _ODP_INLINE static inline
#define odp_event_type __odp_event_type
#define odp_event_type_multi __odp_event_type_multi
+ #define odp_event_pool __odp_event_pool
#define odp_event_user_area __odp_event_user_area
#define odp_event_user_area_and_flag __odp_event_user_area_and_flag
#define odp_event_subtype __odp_event_subtype
@@ -68,6 +70,20 @@ _ODP_INLINE int odp_event_type_multi(const odp_event_t event[], int num,
return i;
}
+_ODP_INLINE odp_pool_t odp_event_pool(odp_event_t event)
+{
+ const odp_event_type_t type = __odp_event_type_get(event);
+
+ switch (type) {
+ case ODP_EVENT_BUFFER:
+ case ODP_EVENT_PACKET:
+ case ODP_EVENT_PACKET_VECTOR:
+ return _odp_event_hdr_field(event, odp_pool_t, pool);
+ default:
+ return ODP_POOL_INVALID;
+ }
+}
+
_ODP_INLINE void *odp_event_user_area(odp_event_t event)
{
const odp_event_type_t type = __odp_event_type_get(event);
diff --git a/platform/linux-generic/include/odp/api/plat/thread_inline_types.h b/platform/linux-generic/include/odp/api/plat/thread_inline_types.h
index c9a15b06b..d24263fa7 100644
--- a/platform/linux-generic/include/odp/api/plat/thread_inline_types.h
+++ b/platform/linux-generic/include/odp/api/plat/thread_inline_types.h
@@ -9,7 +9,7 @@
#define ODP_PLAT_THREAD_INLINE_TYPES_H_
#include <odp/api/init.h>
-#include <odp/api/spec/thread_types.h>
+#include <odp/api/thread_types.h>
#ifdef __cplusplus
extern "C" {
diff --git a/platform/linux-generic/include/odp/api/plat/thread_inlines.h b/platform/linux-generic/include/odp/api/plat/thread_inlines.h
index 2f2e50b06..2b6957064 100644
--- a/platform/linux-generic/include/odp/api/plat/thread_inlines.h
+++ b/platform/linux-generic/include/odp/api/plat/thread_inlines.h
@@ -7,14 +7,14 @@
#ifndef ODP_PLAT_THREAD_INLINES_H_
#define ODP_PLAT_THREAD_INLINES_H_
-#include <odp/api/init.h>
-
-#include <odp/api/plat/thread_inline_types.h>
-
#ifdef __cplusplus
extern "C" {
#endif
+#include <odp/api/thread_types.h>
+
+#include <odp/api/plat/thread_inline_types.h>
+
/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
#ifndef _ODP_NO_INLINE
diff --git a/platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h b/platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h
index eef052f8d..b596d1609 100644
--- a/platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h
+++ b/platform/linux-generic/include/odp/api/plat/ticketlock_inlines.h
@@ -11,7 +11,7 @@
#include <odp/api/cpu.h>
#include <odp/api/abi/ticketlock.h>
-
+#include <odp/api/abi/wait_until.h>
/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
#ifndef _ODP_NO_INLINE
@@ -47,8 +47,7 @@ _ODP_INLINE void odp_ticketlock_lock(odp_ticketlock_t *ticketlock)
/* Spin waiting for our turn. Use load-acquire so that we acquire
* all stores from the previous lock owner */
- while (ticket != odp_atomic_load_acq_u32(&ticketlock->cur_ticket))
- odp_cpu_pause();
+ _odp_wait_until_equal_acq_u32(&ticketlock->cur_ticket, ticket);
}
_ODP_INLINE int odp_ticketlock_trylock(odp_ticketlock_t *tklock)
diff --git a/platform/linux-generic/include/odp/api/plat/time_inlines.h b/platform/linux-generic/include/odp/api/plat/time_inlines.h
index 35a35c72e..8ead06f7b 100644
--- a/platform/linux-generic/include/odp/api/plat/time_inlines.h
+++ b/platform/linux-generic/include/odp/api/plat/time_inlines.h
@@ -35,6 +35,7 @@
#define odp_time_cmp __odp_time_cmp
#define odp_time_diff __odp_time_diff
#define odp_time_diff_ns __odp_time_diff_ns
+ #define odp_time_add_ns __odp_time_add_ns
#define odp_time_sum __odp_time_sum
#define odp_time_local_from_ns __odp_time_local_from_ns
@@ -45,6 +46,7 @@
#define odp_time_wait_ns __odp_time_wait_ns
#define odp_time_wait_until __odp_time_wait_until
+ #define odp_time_startup __odp_time_startup
#else
#define _ODP_INLINE
#endif
@@ -123,6 +125,15 @@ _ODP_INLINE uint64_t odp_time_diff_ns(odp_time_t t2, odp_time_t t1)
return odp_time_to_ns(time);
}
+_ODP_INLINE odp_time_t odp_time_add_ns(odp_time_t time, uint64_t ns)
+{
+ odp_time_t t = _odp_time_from_ns(ns);
+
+ t.u64 += time.u64;
+
+ return t;
+}
+
_ODP_INLINE odp_time_t odp_time_sum(odp_time_t t1, odp_time_t t2)
{
odp_time_t time;
@@ -170,6 +181,11 @@ _ODP_INLINE void odp_time_wait_ns(uint64_t ns)
odp_time_wait_until(end_time);
}
+_ODP_INLINE void odp_time_startup(odp_time_startup_t *startup)
+{
+ _odp_time_startup(startup);
+}
+
/** @endcond */
#endif
diff --git a/platform/linux-generic/include/odp/api/plat/timer_inlines.h b/platform/linux-generic/include/odp/api/plat/timer_inlines.h
index 9ba0287e0..d2982079f 100644
--- a/platform/linux-generic/include/odp/api/plat/timer_inlines.h
+++ b/platform/linux-generic/include/odp/api/plat/timer_inlines.h
@@ -10,6 +10,8 @@
#include <odp/api/event.h>
#include <odp/api/timer_types.h>
+#include <odp/api/abi/time_inlines.h>
+
#include <odp/api/plat/debug_inlines.h>
#include <odp/api/plat/timer_inline_types.h>
@@ -24,6 +26,7 @@
#define odp_timeout_tick __odp_timeout_tick
#define odp_timeout_user_ptr __odp_timeout_user_ptr
#define odp_timeout_user_area __odp_timeout_user_area
+ #define odp_timer_current_tick __odp_timer_current_tick
#define odp_timer_tick_to_ns __odp_timer_tick_to_ns
#define odp_timer_ns_to_tick __odp_timer_ns_to_tick
#define odp_timeout_from_event __odp_timeout_from_event
@@ -53,6 +56,14 @@ _ODP_INLINE void *odp_timeout_user_area(odp_timeout_t tmo)
return _odp_timeout_hdr_field(tmo, void *, uarea_addr);
}
+_ODP_INLINE uint64_t odp_timer_current_tick(odp_timer_pool_t tpid)
+{
+ (void)tpid;
+
+ /* This is equal to odp_time_global_ns(). Cannot call inlined API function from here. */
+ return _odp_time_to_ns(_odp_time_cur());
+}
+
_ODP_INLINE uint64_t odp_timer_tick_to_ns(odp_timer_pool_t tp, uint64_t ticks)
{
(void)tp;
diff --git a/platform/linux-generic/include/odp_chksum_internal.h b/platform/linux-generic/include/odp_chksum_internal.h
index 5a134ae2d..e589ecb94 100644
--- a/platform/linux-generic/include/odp_chksum_internal.h
+++ b/platform/linux-generic/include/odp_chksum_internal.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2020, Nokia
+/* Copyright (c) 2020, 2023, Nokia
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -62,8 +62,23 @@ static inline uint16_t chksum_finalize(uint64_t sum)
static uint64_t chksum_partial(const void *addr, uint32_t len, uint32_t offset)
{
const uint8_t *b;
- const uint16_t *w;
- const uint32_t *d;
+#if _ODP_UNALIGNED
+ /*
+ * _ODP_UNALIGNED does not guarantee that all possible ways of
+ * accessing memory can be unaligned. Make the compiler aware
+ * of the possible unalignment so that it does not generate
+ * instructions (such as LDM of AArch32) that require higher
+ * alignment than one byte.
+ */
+ typedef uint32_t x_uint32_t ODP_ALIGNED(1);
+ typedef uint16_t x_uint16_t ODP_ALIGNED(1);
+#else
+ /* In this case we can use normal types as we align manually. */
+ typedef uint32_t x_uint32_t;
+ typedef uint16_t x_uint16_t;
+#endif
+ const x_uint16_t *w;
+ const x_uint32_t *d;
uint64_t sum = 0;
/*
@@ -77,7 +92,7 @@ static uint64_t chksum_partial(const void *addr, uint32_t len, uint32_t offset)
* We have efficient unaligned access. Just read
* dwords starting at the given address.
*/
- d = (const uint32_t *)addr;
+ d = (const x_uint32_t *)addr;
} else {
/*
* We must avoid unaligned access, so align to 4 bytes
@@ -102,7 +117,7 @@ static uint64_t chksum_partial(const void *addr, uint32_t len, uint32_t offset)
* This cast increases alignment, but it's OK, since
* we've made sure that the pointer value is aligned.
*/
- w = (const uint16_t *)(uintptr_t)b;
+ w = (const x_uint16_t *)(uintptr_t)b;
if ((uintptr_t)w & 2 && len >= 2) {
/* Align bytes by handling an odd word. */
@@ -111,7 +126,7 @@ static uint64_t chksum_partial(const void *addr, uint32_t len, uint32_t offset)
}
/* Increases alignment. */
- d = (const uint32_t *)(uintptr_t)w;
+ d = (const x_uint32_t *)(uintptr_t)w;
}
while (len >= 32) {
@@ -159,7 +174,7 @@ static uint64_t chksum_partial(const void *addr, uint32_t len, uint32_t offset)
len &= 3;
- w = (const uint16_t *)d;
+ w = (const x_uint16_t *)d;
if (len > 1) {
/* Last word. */
sum += *w++;
diff --git a/platform/linux-generic/include/odp_classification_datamodel.h b/platform/linux-generic/include/odp_classification_datamodel.h
index 376dbd1db..c042a5308 100644
--- a/platform/linux-generic/include/odp_classification_datamodel.h
+++ b/platform/linux-generic/include/odp_classification_datamodel.h
@@ -40,14 +40,6 @@ extern "C" {
#define CLS_PMRTERM_MAX 8
/* Maximum PMRs attached in PKTIO Level */
#define CLS_PMR_PER_COS_MAX 8
-/* L2 Priority Bits */
-#define CLS_COS_L2_QOS_BITS 3
-/* Max L2 QoS value */
-#define CLS_COS_MAX_L2_QOS (1 << CLS_COS_L2_QOS_BITS)
-/* L2 DSCP Bits */
-#define CLS_COS_L3_QOS_BITS 6
-/* Max L3 QoS Value */
-#define CLS_COS_MAX_L3_QOS (1 << CLS_COS_L3_QOS_BITS)
/* Max PMR Term size */
#define MAX_PMR_TERM_SIZE 16
/* Max queue per Class of service */
@@ -145,9 +137,6 @@ typedef struct ODP_ALIGNED_CACHE cos_s {
bool queue_group;
odp_cls_hash_proto_t hash_proto;
odp_pktin_vector_config_t vector; /* Packet vector config */
-#if ODP_DEPRECATED_API
- odp_cls_drop_t drop_policy; /* Associated Drop Policy */
-#endif
size_t headroom; /* Headroom for this CoS */
odp_spinlock_t lock; /* cos lock */
odp_queue_param_t queue_param;
@@ -174,28 +163,6 @@ typedef struct ODP_ALIGNED_CACHE {
} _cls_queue_grp_tbl_t;
/**
-L2 QoS and CoS Map
-
-This structure holds the mapping between L2 QoS value and
-corresponding cos_t object
-**/
-typedef struct pmr_l2_cos {
- odp_spinlock_t lock; /* pmr_l2_cos lock */
- cos_t *cos[CLS_COS_MAX_L2_QOS]; /* Array of CoS objects */
-} pmr_l2_cos_t;
-
-/**
-L3 QoS and CoS Map
-
-This structure holds the mapping between L3 QoS value and
-corresponding cos_t object
-**/
-typedef struct pmr_l3_cos {
- odp_spinlock_t lock; /* pmr_l3_cos lock */
- cos_t *cos[CLS_COS_MAX_L3_QOS]; /* Array of CoS objects */
-} pmr_l3_cos_t;
-
-/**
Linux Generic Classifier
This structure is stored in pktio_entry and holds all
@@ -204,9 +171,6 @@ the classifier configuration value.
typedef struct classifier {
cos_t *error_cos; /* Associated Error CoS */
cos_t *default_cos; /* Associated Default CoS */
- uint32_t l3_precedence; /* L3 QoS precedence */
- pmr_l2_cos_t l2_cos_table; /* L2 QoS-CoS table map */
- pmr_l3_cos_t l3_cos_table; /* L3 Qos-CoS table map */
size_t headroom; /* Pktio Headroom */
size_t skip; /* Pktio Skip Offset */
} classifier_t;
diff --git a/platform/linux-generic/include/odp_config_internal.h b/platform/linux-generic/include/odp_config_internal.h
index 279a43687..8fd8c4be7 100644
--- a/platform/linux-generic/include/odp_config_internal.h
+++ b/platform/linux-generic/include/odp_config_internal.h
@@ -20,9 +20,20 @@ extern "C" {
#define CONFIG_NUM_CPU_IDS 256
/*
+ * Maximum number of packet IO resources
+ */
+#define CONFIG_PKTIO_ENTRIES 64
+
+/*
+ * Pools reserved for internal usage, 1 for IPsec status events and one per packet
+ * I/O for TX completion
+ */
+#define CONFIG_INTERNAL_POOLS (1 + CONFIG_PKTIO_ENTRIES)
+
+/*
* Maximum number of pools.
*/
-#define ODP_CONFIG_POOLS 32
+#define CONFIG_POOLS 128
/*
* Queues reserved for ODP internal use
@@ -69,17 +80,12 @@ extern "C" {
#define CONFIG_MAX_STASHES 2048
/*
- * Maximum number of packet IO resources
- */
-#define ODP_CONFIG_PKTIO_ENTRIES 64
-
-/*
* Maximum buffer alignment
*
* This defines the maximum supported buffer alignment. Requests for values
* above this will fail.
*/
-#define ODP_CONFIG_BUFFER_ALIGN_MAX (4 * 1024)
+#define CONFIG_BUFFER_ALIGN_MAX (4 * 1024)
/*
* Default packet headroom
@@ -138,7 +144,7 @@ extern "C" {
* are reserved for per ODP module global data and one block per packet I/O is
* reserved for TX completion usage.
*/
-#define CONFIG_INTERNAL_SHM_BLOCKS ((ODP_CONFIG_POOLS * 3) + 20 + ODP_CONFIG_PKTIO_ENTRIES)
+#define CONFIG_INTERNAL_SHM_BLOCKS ((CONFIG_POOLS * 3) + 20 + CONFIG_PKTIO_ENTRIES)
/*
* Maximum number of shared memory blocks.
diff --git a/platform/linux-generic/include/odp_event_internal.h b/platform/linux-generic/include/odp_event_internal.h
index 4bc28d708..d9957e530 100644
--- a/platform/linux-generic/include/odp_event_internal.h
+++ b/platform/linux-generic/include/odp_event_internal.h
@@ -35,7 +35,7 @@ typedef union _odp_event_index_t {
} _odp_event_index_t;
/* Check that pool index fit into bit field */
-ODP_STATIC_ASSERT(ODP_CONFIG_POOLS <= (0xFF + 1), "TOO_MANY_POOLS");
+ODP_STATIC_ASSERT(CONFIG_POOLS <= (0xFF + 1), "TOO_MANY_POOLS");
/* Check that buffer index fit into bit field */
ODP_STATIC_ASSERT(CONFIG_POOL_MAX_NUM <= (0xFFFFFF + 1), "TOO_LARGE_POOL");
diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h
index eef0239f2..41a44b83c 100644
--- a/platform/linux-generic/include/odp_packet_internal.h
+++ b/platform/linux-generic/include/odp_packet_internal.h
@@ -176,7 +176,7 @@ typedef struct ODP_ALIGNED_CACHE odp_packet_hdr_t {
* grow over 256 bytes. */
ODP_STATIC_ASSERT(sizeof(odp_packet_hdr_t) <= 256, "PACKET_HDR_SIZE_ERROR");
-ODP_STATIC_ASSERT(ODP_CONFIG_PKTIO_ENTRIES < UINT8_MAX, "MS_PKTIO_IDX_SIZE_ERROR");
+ODP_STATIC_ASSERT(CONFIG_PKTIO_ENTRIES < UINT8_MAX, "MS_PKTIO_IDX_SIZE_ERROR");
/**
* Return the packet header
diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h
index 5490c3d01..6c8a2305b 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -184,7 +184,7 @@ typedef struct {
uint32_t tx_compl_pool_size;
} config;
- pktio_entry_t entries[ODP_CONFIG_PKTIO_ENTRIES];
+ pktio_entry_t entries[CONFIG_PKTIO_ENTRIES];
lso_profile_t lso_profile[PKTIO_LSO_PROFILES];
int num_lso_profiles;
@@ -257,9 +257,9 @@ static inline pktio_entry_t *get_pktio_entry(odp_pktio_t pktio)
if (odp_unlikely(pktio == ODP_PKTIO_INVALID))
return NULL;
- if (odp_unlikely(_odp_typeval(pktio) > ODP_CONFIG_PKTIO_ENTRIES)) {
+ if (odp_unlikely(_odp_typeval(pktio) > CONFIG_PKTIO_ENTRIES)) {
_ODP_DBG("pktio limit %" PRIuPTR "/%d exceed\n",
- _odp_typeval(pktio), ODP_CONFIG_PKTIO_ENTRIES);
+ _odp_typeval(pktio), CONFIG_PKTIO_ENTRIES);
return NULL;
}
diff --git a/platform/linux-generic/include/odp_pool_internal.h b/platform/linux-generic/include/odp_pool_internal.h
index c8d2168f3..2c33bb4a2 100644
--- a/platform/linux-generic/include/odp_pool_internal.h
+++ b/platform/linux-generic/include/odp_pool_internal.h
@@ -116,7 +116,7 @@ typedef struct pool_t {
} pool_t;
typedef struct pool_global_t {
- pool_t pool[ODP_CONFIG_POOLS];
+ pool_t pool[CONFIG_POOLS];
odp_shm_t shm;
struct {
diff --git a/platform/linux-generic/include/odp_schedule_scalable.h b/platform/linux-generic/include/odp_schedule_scalable.h
index 207573f4c..28c0a9894 100644
--- a/platform/linux-generic/include/odp_schedule_scalable.h
+++ b/platform/linux-generic/include/odp_schedule_scalable.h
@@ -19,10 +19,10 @@
#include <odp_llqueue.h>
/*
- * ODP_SCHED_PRIO_HIGHEST/NORMAL/LOWEST/DEFAULT are compile time
- * constants, but not ODP_SCHED_PRIO_NUM. The current API for this
- * is odp_schedule_num_prio(). The other schedulers also define
- * this internally as NUM_PRIO.
+ * Define scalable scheduler internal maximum priority count
+ * ODP_SCHED_PRIO_NUM as it is not compile-time constant at API
+ * level. The current API for this is odp_schedule_num_prio().
+ * The other schedulers also define this internally as NUM_PRIO.
*
* One additional priority level for idle pktin queues.
* This is only for internal use and not visible to the user.