diff options
author | Tuomas Taipale <tuomas.taipale@nokia.com> | 2023-06-19 12:58:32 +0000 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2023-06-21 12:44:03 +0300 |
commit | af1a174d919465bf262a0dc5c91edaa1d3688fc1 (patch) | |
tree | f1e840d0072e3b7f876b7c0ab5b87dd37535d618 /platform | |
parent | 72683c2804d9a3c3e63d92c45d1e8cab95ef8be8 (diff) |
linux-gen: pktio: move packet vector cast helper
Move `packet_vector_to_event_hdr()` to `odp_event_vector_internal.h`
where it is reusable also elsewhere. Rename it accordingly.
Signed-off-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
Diffstat (limited to 'platform')
-rw-r--r-- | platform/linux-generic/include/odp_event_vector_internal.h | 10 | ||||
-rw-r--r-- | platform/linux-generic/odp_packet_io.c | 7 |
2 files changed, 10 insertions, 7 deletions
diff --git a/platform/linux-generic/include/odp_event_vector_internal.h b/platform/linux-generic/include/odp_event_vector_internal.h index 55e33b913..39f9daf04 100644 --- a/platform/linux-generic/include/odp_event_vector_internal.h +++ b/platform/linux-generic/include/odp_event_vector_internal.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2020-2021, Nokia +/* Copyright (c) 2020-2023, Nokia * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -58,6 +58,14 @@ static inline odp_event_vector_hdr_t *_odp_packet_vector_hdr(odp_packet_vector_t } /** + * Return the event header + */ +static inline _odp_event_hdr_t *_odp_packet_vector_to_event_hdr(odp_packet_vector_t pktv) +{ + return (_odp_event_hdr_t *)(uintptr_t)&_odp_packet_vector_hdr(pktv)->event_hdr; +} + +/** * Free packet vector and contained packets */ static inline void _odp_packet_vector_free_full(odp_packet_vector_t pktv) diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index ef33b6d77..c4cd87afc 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -72,11 +72,6 @@ static inline pktio_entry_t *pktio_entry_by_index(int index) return _odp_pktio_entry_ptr[index]; } -static inline _odp_event_hdr_t *packet_vector_to_event_hdr(odp_packet_vector_t pktv) -{ - return (_odp_event_hdr_t *)(uintptr_t)&_odp_packet_vector_hdr(pktv)->event_hdr; -} - static int read_config_file(pktio_global_t *pktio_glb) { const char *str; @@ -826,7 +821,7 @@ static inline int pktin_recv_buf(pktio_entry_t *entry, int pktin_index, if (odp_unlikely(pktv == ODP_PACKET_VECTOR_INVALID)) return 0; - event_hdrs[0] = packet_vector_to_event_hdr(pktv); + event_hdrs[0] = _odp_packet_vector_to_event_hdr(pktv); return 1; } |