aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-dpdk/include/odp
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2022-10-11 17:09:13 +0300
committerMatias Elo <matias.elo@nokia.com>2022-10-28 14:58:47 +0300
commit54f58091c22e0002ea15e312e69b3d8a95df9c76 (patch)
treed8bec3eb24748bc4b3332c3fa677c99ce8c5205b /platform/linux-dpdk/include/odp
parent90334006d80f9a00d56db431a65f32fddd5856ad (diff)
Port 117e155bf "linux-gen: packet: inline odp_packet_buf_data_offset() implementation"
Port original commit from linux-generic. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
Diffstat (limited to 'platform/linux-dpdk/include/odp')
-rw-r--r--platform/linux-dpdk/include/odp/api/plat/packet_inlines.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/platform/linux-dpdk/include/odp/api/plat/packet_inlines.h b/platform/linux-dpdk/include/odp/api/plat/packet_inlines.h
index 9f21be37b..2cbab8ad4 100644
--- a/platform/linux-dpdk/include/odp/api/plat/packet_inlines.h
+++ b/platform/linux-dpdk/include/odp/api/plat/packet_inlines.h
@@ -111,6 +111,7 @@ extern "C" {
#define odp_packet_buf_data_len __odp_packet_buf_data_len
#define odp_packet_buf_size __odp_packet_buf_size
#define odp_packet_buf_head __odp_packet_buf_head
+ #define odp_packet_buf_data_offset __odp_packet_buf_data_offset
#else
#undef _ODP_INLINE
#define _ODP_INLINE
@@ -569,6 +570,14 @@ _ODP_INLINE void *odp_packet_buf_head(odp_packet_buf_t pkt_buf)
return (uint8_t *)(uintptr_t)pkt_buf + head_offset;
}
+_ODP_INLINE uint32_t odp_packet_buf_data_offset(odp_packet_buf_t pkt_buf)
+{
+ void *data = odp_packet_seg_data(ODP_PACKET_INVALID, (odp_packet_seg_t)pkt_buf);
+ void *head = odp_packet_buf_head(pkt_buf);
+
+ return (uint32_t)((uintptr_t)data - (uintptr_t)head);
+}
+
#ifdef __cplusplus
}
#endif