Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions platform/linux-generic/include/odp/api/plat/buffer_inline_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,6 @@ extern "C" {

/** @cond _ODP_HIDE_FROM_DOXYGEN_ */

/* Buffer header field accessors */
#define _odp_buffer_get(buffer_hdr, cast, field) \
(*(cast *)(uintptr_t)((uint8_t *)buffer_hdr + \
_odp_buffer_inline_offset.field))

/* Buffer header field offsets for inline functions */
typedef struct _odp_buffer_inline_offset_t {
uint16_t uarea_addr;

} _odp_buffer_inline_offset_t;

extern const _odp_buffer_inline_offset_t _odp_buffer_inline_offset;

/** @endcond */

#ifdef __cplusplus
Expand Down
4 changes: 2 additions & 2 deletions platform/linux-generic/include/odp/api/plat/buffer_inlines.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) 2019-2023 Nokia
* Copyright (c) 2019-2025 Nokia
*/

#ifndef ODP_PLAT_BUFFER_INLINES_H_
Expand Down Expand Up @@ -78,7 +78,7 @@ _ODP_INLINE odp_pool_t odp_buffer_pool(odp_buffer_t buf)

_ODP_INLINE void *odp_buffer_user_area(odp_buffer_t buf)
{
return _odp_buffer_get(buf, void *, uarea_addr);
return _odp_event_hdr_field((odp_event_t)(uintptr_t)buf, void *, user_area);
}

/** @endcond */
Expand Down
2 changes: 1 addition & 1 deletion platform/linux-generic/include/odp/api/plat/dma_inlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ _ODP_INLINE odp_event_t odp_dma_compl_to_event(odp_dma_compl_t dma_compl)

_ODP_INLINE void *odp_dma_compl_user_area(odp_dma_compl_t dma_compl)
{
return odp_buffer_user_area((odp_buffer_t)(uintptr_t)dma_compl);
return _odp_event_hdr_field((odp_event_t)(uintptr_t)dma_compl, void *, user_area);
}

_ODP_INLINE void odp_dma_transfer_param_init(odp_dma_transfer_param_t *trs_param)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) 2018 Linaro Limited
* Copyright (c) 2022 Nokia
* Copyright (c) 2022-2025 Nokia
*/

#ifndef ODP_PLAT_EVENT_INLINE_TYPES_H_
Expand All @@ -26,9 +26,11 @@ extern "C" {
typedef struct _odp_event_inline_offset_t {
uint16_t event_type;
uint16_t base_data;
uint16_t user_area;
uint16_t subtype;
uint16_t flow_id;
uint16_t pool;
uint16_t user_flag;

} _odp_event_inline_offset_t;

Expand Down
89 changes: 6 additions & 83 deletions platform/linux-generic/include/odp/api/plat/event_inlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,11 @@
#ifndef ODP_PLAT_EVENT_INLINES_H_
#define ODP_PLAT_EVENT_INLINES_H_

#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>
#include <odp/api/plat/debug_inlines.h>
#include <odp/api/plat/event_inline_types.h>
#include <odp/api/plat/event_vector_inline_types.h>
#include <odp/api/plat/packet_inline_types.h>
#include <odp/api/plat/timer_inline_types.h>

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -99,92 +92,22 @@ _ODP_INLINE odp_pool_t odp_event_pool(odp_event_t event)

_ODP_INLINE void *odp_event_user_area(odp_event_t event)
{
const odp_event_type_t type = __odp_event_type_get(event);

switch (type) {
case ODP_EVENT_BUFFER:
case ODP_EVENT_ML_COMPL:
case ODP_EVENT_DMA_COMPL:
return _odp_buffer_get((odp_buffer_t)event, void *, uarea_addr);
case ODP_EVENT_PACKET:
return _odp_pkt_get((odp_packet_t)event, void *, user_area);
case ODP_EVENT_VECTOR:
case ODP_EVENT_PACKET_VECTOR:
return _odp_event_vect_get(event, void *, uarea_addr);
case ODP_EVENT_TIMEOUT:
return _odp_timeout_hdr_field((odp_timeout_t)event, void *, uarea_addr);
default:
return NULL;
}
return _odp_event_hdr_field(event, void *, user_area);
}

_ODP_INLINE void *odp_event_user_area_and_flag(odp_event_t event, int *flag)
{
const odp_event_type_t type = __odp_event_type_get(event);

_ODP_ASSERT(flag != NULL);

switch (type) {
case ODP_EVENT_BUFFER:
case ODP_EVENT_DMA_COMPL:
case ODP_EVENT_ML_COMPL:
*flag = -1;
return _odp_buffer_get((odp_buffer_t)event, void *, uarea_addr);
case ODP_EVENT_PACKET:
{
_odp_packet_flags_t pkt_flags;
odp_packet_t pkt = (odp_packet_t)event;

pkt_flags.all_flags = _odp_pkt_get(pkt, uint32_t, flags);
*flag = pkt_flags.user_flag;

return _odp_pkt_get(pkt, void *, user_area);
}
case ODP_EVENT_VECTOR:
case ODP_EVENT_PACKET_VECTOR:
{
_odp_event_vector_flags_t v_flags;

v_flags.all_flags = _odp_event_vect_get(event, uint32_t, flags);
*flag = v_flags.user_flag;

return _odp_event_vect_get(event, void *, uarea_addr);
}
case ODP_EVENT_TIMEOUT:
*flag = -1;
return _odp_timeout_hdr_field((odp_timeout_t)event, void *, uarea_addr);
default:
*flag = -1;
return NULL;
}
*flag = _odp_event_hdr_field(event, int8_t, user_flag);
return _odp_event_hdr_field(event, void *, user_area);
}

_ODP_INLINE void odp_event_user_flag_set(odp_event_t event, int val)
{
const odp_event_type_t type = __odp_event_type_get(event);
int8_t *user_flag = _odp_event_hdr_ptr(event, int8_t, user_flag);

switch (type) {
case ODP_EVENT_PACKET:
{
odp_packet_t pkt = (odp_packet_t)event;
_odp_packet_flags_t *flags = _odp_pkt_get_ptr(pkt, _odp_packet_flags_t, flags);

flags->user_flag = !!val;
return;
}
case ODP_EVENT_VECTOR:
case ODP_EVENT_PACKET_VECTOR:
{
_odp_event_vector_flags_t *flags =
_odp_event_vect_get_ptr(event, _odp_event_vector_flags_t, flags);

flags->user_flag = !!val;
return;
}
default:
/* Nothing to do */
return;
}
if (odp_likely(*user_flag != -1))
*user_flag = !!val;
}

_ODP_INLINE odp_event_subtype_t odp_event_subtype(odp_event_t event)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ extern "C" {

/** @cond _ODP_HIDE_FROM_DOXYGEN_ */

typedef union {
uint32_t all_flags;

struct {
uint32_t user_flag : 1;
};

} _odp_event_vector_flags_t;

/* Event vector field accessors */
#define _odp_event_vect_get(vect, cast, field) \
(*(cast *)(uintptr_t)((uint8_t *)vect + _odp_event_vector_inline.field))
Expand All @@ -33,8 +24,6 @@ typedef struct _odp_event_vector_inline_offset_t {
uint16_t event;
uint16_t pool;
uint16_t size;
uint16_t uarea_addr;
uint16_t flags;

} _odp_event_vector_inline_offset_t;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <odp/api/pool_types.h>

#include <odp/api/plat/debug_inlines.h>
#include <odp/api/plat/event_inline_types.h>
#include <odp/api/plat/event_vector_inline_types.h>

#include <stdint.h>
Expand Down Expand Up @@ -81,24 +82,20 @@ _ODP_INLINE void odp_event_vector_size_set(odp_event_vector_t evv, uint32_t size

_ODP_INLINE void *odp_event_vector_user_area(odp_event_vector_t evv)
{
return _odp_event_vect_get(evv, void *, uarea_addr);
return _odp_event_hdr_field((odp_event_t)(uintptr_t)evv, void *, user_area);
}

_ODP_INLINE int odp_event_vector_user_flag(odp_event_vector_t evv)
{
_odp_event_vector_flags_t flags;

flags.all_flags = _odp_event_vect_get(evv, uint32_t, flags);

return flags.user_flag;
return _odp_event_hdr_field((odp_event_t)(uintptr_t)evv, int8_t, user_flag);
}

_ODP_INLINE void odp_event_vector_user_flag_set(odp_event_vector_t evv, int val)
{
_odp_event_vector_flags_t *flags = _odp_event_vect_get_ptr(evv, _odp_event_vector_flags_t,
flags);
odp_event_t event = (odp_event_t)(uintptr_t)evv;
int8_t *user_flag = _odp_event_hdr_ptr(event, int8_t, user_flag);

flags->user_flag = !!val;
*user_flag = !!val;
}

/** @endcond */
Expand Down
29 changes: 10 additions & 19 deletions platform/linux-generic/include/odp/api/plat/packet_flag_inlines.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright (c) 2017-2018 Linaro Limited
* Copyright (c) 2022-2024 Nokia
* Copyright (c) 2022-2025 Nokia
*/

/**
Expand All @@ -12,8 +12,8 @@
#ifndef _ODP_PLAT_PACKET_FLAG_INLINES_H_
#define _ODP_PLAT_PACKET_FLAG_INLINES_H_

#include <odp/api/abi/packet_types.h>
#include <odp/api/plat/packet_inline_types.h>
#include <odp/api/packet_types.h>
#include <odp/api/hints.h>

#ifdef __cplusplus
Expand All @@ -22,9 +22,9 @@ extern "C" {

/** @cond _ODP_HIDE_FROM_DOXYGEN_ */

static inline uint64_t _odp_packet_input_flags(odp_packet_t pkt)
static inline uint32_t _odp_packet_input_flags(odp_packet_t pkt)
{
return _odp_pkt_get(pkt, uint64_t, input_flags);
return _odp_pkt_get(pkt, uint32_t, input_flags);
}

#ifndef _ODP_NO_INLINE
Expand Down Expand Up @@ -225,34 +225,25 @@ _ODP_INLINE int odp_packet_has_ipopt(odp_packet_t pkt)

_ODP_INLINE int odp_packet_has_udp(odp_packet_t pkt)
{
_odp_packet_input_flags_t flags;

flags.all = _odp_packet_input_flags(pkt);
return flags.udp;
return _odp_pkt_get(pkt, odp_proto_l4_type_t, l4_type) == ODP_PROTO_L4_TYPE_UDP;
}

_ODP_INLINE int odp_packet_has_tcp(odp_packet_t pkt)
{
_odp_packet_input_flags_t flags;

flags.all = _odp_packet_input_flags(pkt);
return flags.tcp;
return _odp_pkt_get(pkt, odp_proto_l4_type_t, l4_type) == ODP_PROTO_L4_TYPE_TCP;
}

_ODP_INLINE int odp_packet_has_sctp(odp_packet_t pkt)
{
_odp_packet_input_flags_t flags;

flags.all = _odp_packet_input_flags(pkt);
return flags.sctp;
return _odp_pkt_get(pkt, odp_proto_l4_type_t, l4_type) == ODP_PROTO_L4_TYPE_SCTP;
}

_ODP_INLINE int odp_packet_has_icmp(odp_packet_t pkt)
{
_odp_packet_input_flags_t flags;
odp_proto_l4_type_t l4_type = _odp_pkt_get(pkt, odp_proto_l4_type_t, l4_type);

flags.all = _odp_packet_input_flags(pkt);
return flags.icmp;
return (l4_type == ODP_PROTO_L4_TYPE_ICMPV4 ||
l4_type == ODP_PROTO_L4_TYPE_ICMPV6);
}

_ODP_INLINE int odp_packet_has_error(odp_packet_t pkt)
Expand Down
Loading