Skip to content

Commit

Permalink
linux-dpdk: packet: inline odp_packet_reset_max_len() implementation
Browse files Browse the repository at this point in the history
Inline implementation of odp_packet_reset_max_len() function.

Signed-off-by: Matias Elo <[email protected]>
Reviewed-by: Tuomas Taipale <[email protected]>
  • Loading branch information
MatiasElo committed Jun 5, 2024
1 parent 374159b commit 87913e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 7 additions & 1 deletion platform/linux-dpdk/include/odp/api/plat/packet_inlines.h
Original file line number Diff line number Diff line change
@@ -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
*/

/**
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
{
Expand Down
7 changes: 1 addition & 6 deletions platform/linux-dpdk/odp_packet.c
Original file line number Diff line number Diff line change
@@ -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 <odp/api/align.h>
Expand Down Expand Up @@ -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)))
Expand Down

0 comments on commit 87913e6

Please sign in to comment.