aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2023-06-28 16:36:45 +0300
committerMatias Elo <matias.elo@nokia.com>2023-08-08 09:54:40 +0300
commit434495464693467ad995e8e8a339677e2a869326 (patch)
treebe8ed3c8111763444400a68edcc26f9e9f09a4ec
parent931808eb24561bd77e55dd87c75208a1f6868033 (diff)
linux-dpdk: packet: move event subtype to _odp_event_hdr_int_t
After the previous event header reorganization (d6461dfb2) there is now a one byte gap in the _odp_event_hdr_int_t struct. Move odp_packet_hdr_t.subtype to this gap, after which all data required by packet_init() is located on the same cache line. This can improve performance for example with odp_l2fwd application. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
-rw-r--r--platform/linux-dpdk/include/odp_event_internal.h3
-rw-r--r--platform/linux-dpdk/include/odp_packet_internal.h15
-rw-r--r--platform/linux-dpdk/odp_packet.c6
3 files changed, 13 insertions, 11 deletions
diff --git a/platform/linux-dpdk/include/odp_event_internal.h b/platform/linux-dpdk/include/odp_event_internal.h
index 6a707606a..cbe6d960b 100644
--- a/platform/linux-dpdk/include/odp_event_internal.h
+++ b/platform/linux-dpdk/include/odp_event_internal.h
@@ -46,6 +46,9 @@ typedef struct _odp_event_hdr_int_t {
/* Event type. Maybe different than pool type (crypto compl event) */
int8_t event_type;
+ /* Event subtype */
+ int8_t subtype;
+
/* Event flow id */
uint8_t flow_id;
diff --git a/platform/linux-dpdk/include/odp_packet_internal.h b/platform/linux-dpdk/include/odp_packet_internal.h
index df4f2318e..1b602c17a 100644
--- a/platform/linux-dpdk/include/odp_packet_internal.h
+++ b/platform/linux-dpdk/include/odp_packet_internal.h
@@ -124,8 +124,10 @@ typedef struct ODP_ALIGNED_CACHE odp_packet_hdr_t {
/* Common internal header */
_odp_event_hdr_int_t event_hdr;
+ /* Parser metadata */
packet_parser_t p;
+ /* Input interface */
odp_pktio_t input;
/* Timestamp value */
@@ -162,9 +164,6 @@ typedef struct ODP_ALIGNED_CACHE odp_packet_hdr_t {
/* LSO profile index */
uint8_t lso_profile_idx;
- /* Event subtype */
- int8_t subtype;
-
union {
/* Result for crypto packet op */
odp_crypto_packet_result_t crypto_op_result;
@@ -215,7 +214,7 @@ static inline struct rte_mbuf *pkt_to_mbuf(odp_packet_t pkt)
static inline void packet_subtype_set(odp_packet_t pkt, int ev)
{
- packet_hdr(pkt)->subtype = ev;
+ packet_hdr(pkt)->event_hdr.subtype = ev;
}
/**
@@ -231,8 +230,8 @@ static inline void packet_init(odp_packet_hdr_t *pkt_hdr, odp_pktio_t input)
pkt_hdr->p.l3_offset = ODP_PACKET_OFFSET_INVALID;
pkt_hdr->p.l4_offset = ODP_PACKET_OFFSET_INVALID;
- if (odp_unlikely(pkt_hdr->subtype != ODP_EVENT_PACKET_BASIC))
- pkt_hdr->subtype = ODP_EVENT_PACKET_BASIC;
+ if (odp_unlikely(pkt_hdr->event_hdr.subtype != ODP_EVENT_PACKET_BASIC))
+ pkt_hdr->event_hdr.subtype = ODP_EVENT_PACKET_BASIC;
pkt_hdr->input = input;
}
@@ -277,10 +276,10 @@ static inline void _odp_packet_copy_md(odp_packet_hdr_t *dst_hdr,
odp_packet_hdr_t *src_hdr,
odp_bool_t uarea_copy)
{
- const int8_t subtype = src_hdr->subtype;
+ const int8_t subtype = src_hdr->event_hdr.subtype;
dst_hdr->input = src_hdr->input;
- dst_hdr->subtype = subtype;
+ dst_hdr->event_hdr.subtype = subtype;
dst_hdr->dst_queue = src_hdr->dst_queue;
dst_hdr->cos = src_hdr->cos;
dst_hdr->cls_mark = src_hdr->cls_mark;
diff --git a/platform/linux-dpdk/odp_packet.c b/platform/linux-dpdk/odp_packet.c
index 0a0b414fb..95149118e 100644
--- a/platform/linux-dpdk/odp_packet.c
+++ b/platform/linux-dpdk/odp_packet.c
@@ -64,7 +64,7 @@ const _odp_packet_inline_offset_t _odp_packet_inline ODP_ALIGNED_CACHE = {
.timestamp = offsetof(odp_packet_hdr_t, timestamp),
.input_flags = offsetof(odp_packet_hdr_t, p.input_flags),
.flags = offsetof(odp_packet_hdr_t, p.flags),
- .subtype = offsetof(odp_packet_hdr_t, subtype),
+ .subtype = offsetof(odp_packet_hdr_t, event_hdr.subtype),
.cls_mark = offsetof(odp_packet_hdr_t, cls_mark),
.ipsec_ctx = offsetof(odp_packet_hdr_t, ipsec_ctx),
.crypto_op = offsetof(odp_packet_hdr_t, crypto_op_result),
@@ -1018,7 +1018,7 @@ void odp_packet_print(odp_packet_t pkt)
odp_packet_to_u64(pkt));
len += _odp_snprint(&str[len], n - len, " pool index %u\n", pool->pool_idx);
len += _odp_snprint(&str[len], n - len, " buf index %u\n", hdr->event_hdr.index);
- len += _odp_snprint(&str[len], n - len, " ev subtype %i\n", hdr->subtype);
+ len += _odp_snprint(&str[len], n - len, " ev subtype %i\n", hdr->event_hdr.subtype);
len += _odp_snprint(&str[len], n - len, " input_flags 0x%" PRIx64 "\n",
hdr->p.input_flags.all);
if (hdr->p.input_flags.all) {
@@ -1931,7 +1931,7 @@ odp_packet_t odp_packet_reassemble(odp_pool_t pool_hdl,
pkt_hdr->mb.data_off = headroom;
/* Reset metadata */
- pkt_hdr->subtype = ODP_EVENT_PACKET_BASIC;
+ pkt_hdr->event_hdr.subtype = ODP_EVENT_PACKET_BASIC;
pkt_hdr->input = ODP_PKTIO_INVALID;
packet_parse_reset(pkt_hdr, 1);