From 87913e636da621d47a8d3bc91fbe131abc09c294 Mon Sep 17 00:00:00 2001 From: Matias Elo Date: Mon, 20 May 2024 10:33:07 +0300 Subject: [PATCH] linux-dpdk: packet: inline odp_packet_reset_max_len() implementation Inline implementation of odp_packet_reset_max_len() function. Signed-off-by: Matias Elo Reviewed-by: Tuomas Taipale --- platform/linux-dpdk/include/odp/api/plat/packet_inlines.h | 8 +++++++- platform/linux-dpdk/odp_packet.c | 7 +------ 2 files changed, 8 insertions(+), 7 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 5a830fe77..627ed1d44 100644 --- a/platform/linux-dpdk/include/odp/api/plat/packet_inlines.h +++ b/platform/linux-dpdk/include/odp/api/plat/packet_inlines.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: BSD-3-Clause * Copyright (c) 2016-2018 Linaro Limited - * Copyright (c) 2019-2023 Nokia + * Copyright (c) 2019-2024 Nokia */ /** @@ -59,6 +59,7 @@ extern "C" { #define odp_packet_data_seg_len __odp_packet_data_seg_len #define odp_packet_len __odp_packet_len #define odp_packet_buf_len __odp_packet_buf_len + #define odp_packet_reset_max_len __odp_packet_reset_max_len #define odp_packet_headroom __odp_packet_headroom #define odp_packet_tailroom __odp_packet_tailroom #define odp_packet_pool __odp_packet_pool @@ -185,6 +186,11 @@ _ODP_INLINE uint32_t odp_packet_buf_len(odp_packet_t pkt) return (uint32_t)(mb->nb_segs * mb->buf_len); } +_ODP_INLINE uint32_t odp_packet_reset_max_len(odp_packet_t pkt) +{ + return odp_packet_buf_len(pkt) - RTE_PKTMBUF_HEADROOM; +} + _ODP_INLINE void *odp_packet_data_seg_len(odp_packet_t pkt, uint32_t *seg_len) { diff --git a/platform/linux-dpdk/odp_packet.c b/platform/linux-dpdk/odp_packet.c index d17689bb2..e08654d93 100644 --- a/platform/linux-dpdk/odp_packet.c +++ b/platform/linux-dpdk/odp_packet.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: BSD-3-Clause * Copyright (c) 2013-2018 Linaro Limited - * Copyright (c) 2019-2023 Nokia + * Copyright (c) 2019-2024 Nokia */ #include @@ -321,11 +321,6 @@ int odp_packet_alloc_multi(odp_pool_t pool_hdl, uint32_t len, return packet_alloc_multi(pool, len, pkt, num); } -uint32_t odp_packet_reset_max_len(odp_packet_t pkt) -{ - return odp_packet_buf_len(pkt) - RTE_PKTMBUF_HEADROOM; -} - int odp_packet_reset(odp_packet_t pkt, uint32_t len) { if (odp_unlikely(len == 0 || len > odp_packet_reset_max_len(pkt)))