Skip to content

Commit

Permalink
linux-dpdk: pktio: optimize packet receive code
Browse files Browse the repository at this point in the history
Remove if branch from packet_init() as all data touched by the function is
now located on the same cache line. Packet data prefetch has been removed
from input_pkts_minimal() to avoid excessive prefetching. Packet header
prefetch utilizes now odp_prefetch_store() as the header fields are being
initialized.

Signed-off-by: Matias Elo <[email protected]>
Reviewed-by: Tuomas Taipale <[email protected]>
  • Loading branch information
MatiasElo committed Aug 8, 2023
1 parent 4344954 commit 1200684
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions platform/linux-dpdk/include/odp_packet_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,7 @@ 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->event_hdr.subtype != ODP_EVENT_PACKET_BASIC))
pkt_hdr->event_hdr.subtype = ODP_EVENT_PACKET_BASIC;

pkt_hdr->event_hdr.subtype = ODP_EVENT_PACKET_BASIC;
pkt_hdr->input = input;
}

Expand Down
4 changes: 1 addition & 3 deletions platform/linux-dpdk/odp_packet_dpdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ static inline void prefetch_pkt(odp_packet_t pkt)
{
odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);

odp_prefetch(&pkt_hdr->p);
odp_prefetch_store(&pkt_hdr->p);
}

/**
Expand Down Expand Up @@ -978,8 +978,6 @@ static inline int input_pkts_minimal(pktio_entry_t *pktio_entry, odp_packet_t pk
packet_init(pkt_hdr, input);

packet_set_ts(pkt_hdr, ts);

odp_prefetch(rte_pktmbuf_mtod(pkt_to_mbuf(pkt), char *));
}

return num;
Expand Down

0 comments on commit 1200684

Please sign in to comment.