aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-dpdk/include/odp/api
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2022-10-11 17:04:54 +0300
committerMatias Elo <matias.elo@nokia.com>2022-10-28 14:58:47 +0300
commit90334006d80f9a00d56db431a65f32fddd5856ad (patch)
treef8538f9f07f67cddd35077ea9de3748f4b6f6b1d /platform/linux-dpdk/include/odp/api
parent5a2fc747a9c39c5b88d52a8fbae229bb950cea63 (diff)
Port 29f112c6a "linux-gen: packet: inline odp_packet_buf_head() 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/api')
-rw-r--r--platform/linux-dpdk/include/odp/api/plat/packet_inlines.h13
1 files changed, 13 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 f5f0f2f26..9f21be37b 100644
--- a/platform/linux-dpdk/include/odp/api/plat/packet_inlines.h
+++ b/platform/linux-dpdk/include/odp/api/plat/packet_inlines.h
@@ -110,6 +110,7 @@ extern "C" {
#define odp_packet_shaper_len_adjust __odp_packet_shaper_len_adjust
#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
#else
#undef _ODP_INLINE
#define _ODP_INLINE
@@ -556,6 +557,18 @@ _ODP_INLINE uint32_t odp_packet_buf_size(odp_packet_buf_t pkt_buf)
return _odp_pool_get(pool, uint32_t, seg_len);
}
+_ODP_INLINE void *odp_packet_buf_head(odp_packet_buf_t pkt_buf)
+{
+ odp_pool_t pool = _odp_pkt_get(pkt_buf, odp_pool_t, pool);
+ const uint32_t head_offset = _odp_pool_get(pool, uint32_t, ext_head_offset);
+
+ /* Check that pool is external */
+ if (odp_unlikely(!head_offset))
+ return NULL;
+
+ return (uint8_t *)(uintptr_t)pkt_buf + head_offset;
+}
+
#ifdef __cplusplus
}
#endif