aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/pktio/loop.c
diff options
context:
space:
mode:
authorJanne Peltonen <janne.peltonen@nokia.com>2021-09-13 13:50:41 +0300
committerMatias Elo <matias.elo@nokia.com>2021-09-23 12:08:02 +0300
commite108b53c8d3138151257bebfd918305cc7479b73 (patch)
treeb83496be439e53f7524c05f437f22508f0962116 /platform/linux-generic/pktio/loop.c
parent6b93469a77232031113e63616d124dfe41627e29 (diff)
linux-gen: pktio: loop: fix parsing of segmented packets
The receive processing in loop pktio processes packets that have the same underlying packet buffers as they had when sent. This means that, unlike other pktios that allocate packet buffers, loop may have packets with inconvenient segment boundaries in the receive path. Such packets may get parsed incorrectly since loop uses a parsing function that assumes contiguous packet data for the parsed headers. Fix the problem by doing parsing using odp_packet_parse() which can handle segmented packets too. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
Diffstat (limited to 'platform/linux-generic/pktio/loop.c')
-rw-r--r--platform/linux-generic/pktio/loop.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c
index 437977771..889a270ea 100644
--- a/platform/linux-generic/pktio/loop.c
+++ b/platform/linux-generic/pktio/loop.c
@@ -172,9 +172,16 @@ static int loopback_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED,
pkt_hdr = packet_hdr(new_pkt);
}
} else {
- _odp_packet_parse_layer(pkt_hdr,
- pktio_entry->s.config.parser.layer,
- pktio_entry->s.in_chksums);
+ odp_packet_parse_param_t param;
+
+ /*
+ * Use odp_packet_parse() which can handle segmented
+ * packets.
+ */
+ param.proto = ODP_PROTO_ETH;
+ param.last_layer = pktio_entry->s.config.parser.layer;
+ param.chksums = pktio_entry->s.in_chksums;
+ odp_packet_parse(packet_handle(pkt_hdr), 0, &param);
}
packet_set_ts(pkt_hdr, ts);